在使用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布局文件中的位置竟然会影响编译结果

更多相关文章

  1. Android系列之Android(安卓)命令行手动编译打包详解
  2. 解决Could not find method android() for arguments问题
  3. Android(安卓)自动编译、打包生成apk文件 4 - 多渠道批量打包
  4. 基于 Android(安卓)NDK 的学习之旅-----环境搭建
  5. 基于 Android(安卓)NDK 的学习之旅-----环境搭建
  6. Android系统编译环境变量的设置
  7. javafx for android or ios ?
  8. RelativeLayout里常用的位置属性
  9. android交叉编译工具链接下载

随机推荐

  1. Android过滤特殊字符和emoji表情
  2. Android(安卓)Drawable之GradientDrawabl
  3. Android(安卓)shape使用笔记
  4. Android--电商首页的分页导航
  5. Android(安卓)实现button点击效果的两种
  6. android之视频播放系统VideoView和自定义
  7. Things of Android
  8. Android(安卓)Camera2 HAL3 高通Qualcomm
  9. Gradle相关问题
  10. android10 su