android商品詳情頁面設(shè)計詳解
本文實例為大家分享了android商品詳情展示的具體代碼,供大家參考,具體內(nèi)容如下
首先看下效果圖(樣式,布局可以根據(jù)產(chǎn)品要求改變),
先大致說一下,整體結(jié)構(gòu)使用的是LinearLayout實現(xiàn),分上下兩部分,上邊就是我們能滑動的自定義布局,下面就是“進(jìn)入店鋪”,“立即購買”這兩個無關(guān)緊要的布局;
下面是根據(jù)產(chǎn)品的要求更改的,每個APP幾乎都不一樣,所以說是無關(guān)緊要;
布局文件骨架:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <!--因為要在整體布局右下角放一個置頂圖標(biāo),所以用frameLayout包裹一下--> <FrameLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"> <!--自定義的相對布局--> <www.gd.com.goodsdetails.view.ScrollViewContainer android:layout_width="match_parent" android:layout_height="match_parent"> <!--上半?yún)^(qū)域的scrollview,因為上半?yún)^(qū)域也要滑動--> <ScrollView android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"> <FrameLayout android:layout_width="match_parent" android:layout_height="240dp"> <!--這塊區(qū)域放輪播圖--> </FrameLayout> <FrameLayout android:layout_width="match_parent" android:layout_height="500dp"> <!--這塊區(qū)域放商品詳情信息--> </FrameLayout> <!-- 中間繼續(xù)拖動條目(繼續(xù)拖動,查看圖文詳情) 可以根據(jù)產(chǎn)品需求更改自己想要的樣式(一般這里都是一些簡單的文字) --> <RelativeLayout android:layout_width="match_parent" android:layout_height="40dp"> ...... </RelativeLayout> </LinearLayout> </ScrollView><!--結(jié)束:上半?yún)^(qū)域的scrollview--> <!--下面需要顯示的webview了--> <WebView android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" /> </www.gd.com.goodsdetails.view.ScrollViewContainer> <!--一鍵滑到頂部的圖片--> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|right" android:layout_margin="15dp" /> </FrameLayout> <!--*******************************************************--> <!--這些無關(guān)緊要,“進(jìn)入店鋪”,“立即購買”--> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <span style="white-space:pre"> </span>...... </LinearLayout> </LinearLayout>
真?zhèn)€頁面最大的難點就是這個自定義的布局文件:ScrollViewContainer
不過非常爽的就是大家不用自己寫,直接從demo中把ScrollViewContainer復(fù)制到自己的項目中即可使用,非常方便;
效果圖就是我們項目中真是使用的,ScrollViewContainer同樣分為上下兩部分,從“拖動條目”分開;
上半部分最上面一般都會放置一個輪播圖,然后下面放一些商品詳情,讓大家選擇的一些屬性信息;
這些大家可以根據(jù)需求自己添加;
下半部分一般都是放一個webview但是“京東”放置了三個;
我們不用糾結(jié)放置幾個,因為我們可以把下面的webview更改為ScrollView,然后里面想放什么放什么;
點擊打開鏈接免費下載源碼
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
Android自定義控件之創(chuàng)建可復(fù)用的組合控件
這篇文章主要為大家詳細(xì)介紹了Android自定義控件之創(chuàng)建可復(fù)用的組合控件,具有一定的參考價值,感興趣的小伙伴們可以參考一下2016-12-12Android在fragment中編寫toobar的步驟詳解
這篇文章主要介紹了Android在fragment中編寫toobar,本文分步驟通過實例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2021-01-01android實用工具類分享(獲取內(nèi)存/檢查網(wǎng)絡(luò)/屏幕高度/手機(jī)分辨率)
這篇文章主要介紹了android實用工具類,包括獲取內(nèi)存、檢查網(wǎng)絡(luò)、屏幕高度、手機(jī)分辨率、獲取版本號等功能,需要的朋友可以參考下2014-03-03Android studio 2020中的Android SDK 下載教程
這篇文章主要介紹了Android studio 2020中的Android SDK 下載教程,本文圖文并茂給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-03-03Android使用HorizontalScrollView實現(xiàn)水平滾動
這篇文章主要為大家詳細(xì)介紹了Android使用HorizontalScrollView實現(xiàn)水平滾動,并點擊有相應(yīng)的反應(yīng)效果,具有一定的參考價值,感興趣的小伙伴們可以參考一下2018-11-11Android中的Retrofit+OkHttp+RxJava緩存架構(gòu)使用
Retrofit和OkHttp API以及JVM擴(kuò)展RxJava都是開源項目,大家可以輕松在GitHub上找到,下載和基本配置部分這里我們不作重點,主要還是來看一下Android中的Retrofit+OkHttp+RxJava緩存架構(gòu)使用:2016-06-06Android Jetpack架構(gòu)組件 ViewModel詳解
這篇文章主要介紹了Android Jetpack架構(gòu)組件 ViewModel詳解,ViewModel類讓數(shù)據(jù)可在發(fā)生屏幕旋轉(zhuǎn)等配置更改后繼續(xù)存在,ViewModel類旨在以注重生命周期的方式存儲和管理界面相關(guān)的數(shù)據(jù)。感興趣可以來學(xué)習(xí)一下2020-07-07