关于RelativeLayout的一点经验
16lz
2021-12-04
在使用RelativeLayout时,当用到layout above 和 layout bottom等属性时如下的xml会编译出错
<RelativeLayout android:id="@+id/RelativeLayout01"android:layout_width="wrap_content" android:layout_height="wrap_content"><View android:id="@+id/View02" android:layout_width="wrap_content"android:layout_height="wrap_content" android:layout_above="@id/View01"></View><View android:id="@+id/View01" android:layout_width="wrap_content"android:layout_height="wrap_content"></View></RelativeLayout>
解决的方法很简单,掉换一下View01和View02的位置
<RelativeLayout android:id="@+id/RelativeLayout01"android:layout_width="wrap_content" android:layout_height="wrap_content"><View android:id="@+id/View01" android:layout_width="wrap_content"android:layout_height="wrap_content"></View><View android:id="@+id/View02" android:layout_width="wrap_content"android:layout_height="wrap_content" android:layout_above="@id/View01"></View></RelativeLayout>
这个布局问题曾经困扰了我好长时间。。。实在想不到空间在xml布局文件中的位置竟然会影响编译结果
更多相关文章
- Android系列之Android(安卓)命令行手动编译打包详解
- 解决Could not find method android() for arguments问题
- Android(安卓)自动编译、打包生成apk文件 4 - 多渠道批量打包
- 基于 Android(安卓)NDK 的学习之旅-----环境搭建
- 基于 Android(安卓)NDK 的学习之旅-----环境搭建
- Android系统编译环境变量的设置
- javafx for android or ios ?
- RelativeLayout里常用的位置属性
- android交叉编译工具链接下载