在使用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 LinearLayout布局子空间没有填充父控件的问题
  2. RelativeLayout里常用的位置属性
  3. Android界面布局详解
  4. android_relative布局参数学习
  5. Android开发之——布局实例
  6. 【Android 界面效果14】RelativeLayout里常用的位置属性

随机推荐

  1. cubieboard刷机
  2. AutoCompleteTextView 无限制输入字符及
  3. android:transcriptMode用法
  4. webkit里网页调用android的方法(函数)
  5. android 内核编程
  6. Android学习之Intent实现页面跳转
  7. 定制android通知(Notification)
  8. Android(4.Activity的基本控件)
  9. Binder驱动之内存映射----binder_mmap
  10. 说说在 Android(安卓)中如何发送 HTTP 请