<?xml version="1.0" encoding="UTF-8"?>
-<android.support.constraint.ConstraintLayout tools:context="com.example.asus.my.MainActivity" android:layout_height="match_parent" android:layout_width="match_parent" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android">
<android.support.v7.widget.RecyclerView android:layout_height="match_parent" android:layout_width="match_parent" android:id="@+id/recycler_view"> </android.support.v7.widget.RecyclerView>
</android.support.constraint.ConstraintLayout>
<?xml version="1.0" encoding="UTF-8"?>
-<LinearLayout android:layout_height="wrap_content" android:layout_width="match_parent" android:gravity="center_horizontal" android:orientation="vertical" android:layout_margin="20dp" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView android:layout_height="200dp" android:layout_width="200dp" app:srcCompat="@mipmap/ic_launcher" android:scaleType="fitXY" android:id="@+id/imageView"/>
<TextView android:layout_height="wrap_content" android:layout_width="match_parent" android:gravity="center" android:id="@+id/textView" android:textSize="20dp" android:textColor="#000000" android:textStyle="bold" android:text="TextView" android:layout_marginTop="20dp"/>
<TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:gravity="center" android:id="@+id/textView2" android:textColor="@color/colorAccent" android:text="TextView" android:layout_marginTop="14dp" android:layout_marginBottom="20dp"/>
<TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:gravity="center" android:id="@+id/textView3" android:textColor="@color/colorWhite" android:text="查看商品 >" android:background="@color/colorAccent" android:padding="10dp"/>
</LinearLayout>
<?xml version="1.0" encoding="UTF-8"?>
-<LinearLayout android:layout_height="match_parent" android:layout_width="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView android:layout_height="wrap_content" android:layout_width="wrap_content" app:srcCompat="@mipmap/ic_launcher" android:layout_weight="1" android:id="@+id/imageView2"/>
</LinearLayout>1
最新推荐文章于 2022-05-30 11:22:09 发布
本文介绍了一个具体的Android应用程序UI布局案例,包含使用ConstraintLayout进行主界面布局及LinearLayout内多个UI组件如ImageView、TextView的配置方法。此外,还展示了RecyclerView的集成方式。
15万+

被折叠的 条评论
为什么被折叠?



