<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/rl" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="2dp" android:layout_marginRight="2dp" android:layout_marginTop="2dp"> <ImageView android:id="@+id/image" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:src="@mipmap/test" /> <ImageView android:visibility="gone" android:id="@+id/is_add_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentEnd="true" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:src="@mipmap/is_add_image" /> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="12dp" android:layout_marginBottom="2dp" android:layout_marginLeft="2dp" android:layout_marginRight="2dp" android:background="@color/context_bag"> <TextView android:id="@+id/name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="66" android:textColor="#ebeaed" android:textSize="10sp" /> </RelativeLayout> </LinearLayout> </LinearLayout>//最外层充满,其他都是自适应高度,GridView高度也充满
防止GridView或者recycleview item图片变形
最新推荐文章于 2022-05-02 00:28:24 发布
本文介绍了一个具体的XML布局文件实例,详细解析了如何使用LinearLayout、RelativeLayout等组件进行页面布局,并展示了ImageView、TextView等UI元素的应用方式。
1223

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



