这篇文章将为大家详细讲解有关android中怎么实现一个商品详情页面,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。
布局文件骨架:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!--因为要在整体布局右下角放一个置顶图标,所以用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">
<!--上半区域的scrollview,因为上半区域也要滑动-->
<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">
<!--这块区域放轮播图-->
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="500dp">
<!--这块区域放商品详情信息-->
</FrameLayout>
<!--
中间继续拖动条目(继续拖动,查看图文详情)
可以根据产品需求更改自己想要的样式(一般这里都是一些简单的文字)
-->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="40dp">
......
</RelativeLayout>
</LinearLayout>
</ScrollView><!--结束:上半区域的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>
<!--*******************************************************-->
<!--这些无关紧要,“进入店铺”,“立即购买”-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<span > </span>......
</LinearLayout>
</LinearLayout>
关于android中怎么实现一个商品详情页面就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。