直播带货源码,普通商城购物页面的制作实现的相关代码
在res/layout文件中,放置一个TextView控件用于显示购物商城界面的标题,放置一个ListView控件用于显示购物商场界面的列表
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="45dp"
android:text="购物商城"
android:textSize="18sp"
android:textColor="#FFFFFF"
android:background="#FF8F03"
android:gravity="center"/>
<ListView
android:id="@+id/lv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:listSelector="@color/colorAccent" />
</LinearLayout>
list_Item.xml
在res/layout文件中创建一个列表条目界面的布局文件list_item.xml,在该文件中放置一个Image View控件用于显示商品的图片;放置2个TextView控件分别用于显示商品的名称和价格!
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<ImageView
android:id="@+id/iv"
android:layout_width="120dp"
android:layout_height="90dp"
android:layout_centerVertical="true" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@+id/iv">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="桌子"
android:textColor="#000000"
android:textSize="20sp" />
<TextView
android:id="@+id/tv_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/title"
android:layout_marginTop="10dp"
android:text="价格:"
android:textColor="#FF8F03"
android:textSize="20sp" />
<TextView
android:id="@+id/price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/title"
android:layout_marginTop="10dp"
android:layout_toRightOf="@+id/tv_price"
android:text="1000"
android:textColor="#FF8F03"
android:textSize="20sp" />
</RelativeLayout>
</RelativeLayout>
以上就是 直播带货源码,普通商城购物页面的制作实现的相关代码,更多内容欢迎关注之后的文章