错误是这样的,布局文件如下,总是在SeekBar里面的这一句android:layout_toLeftOf="@id/voice_max"报错,差点气得我吐血,明明没有错误的.

<ImageView         android:id="@+id/voice_min"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_alignParentLeft="true"        android:layout_centerVertical="true"        android:background="@drawable/voice_min"/><SeekBar         android:id="@+id/sb_voice"        android:layout_height="wrap_content"        android:layout_width="fill_parent"        android:layout_centerVertical="true"        android:layout_toLeftOf="@id/voice_max"        android:layout_toRightOf="@id/voice_min"        android:paddingLeft="5dp"        android:paddingRight="5dp"        android:background="@drawable/voice_seekbar_bg"        /><ImageView         android:id="@+id/voice_max"        android:layout_height="wrap_content"        android:layout_width="wrap_content"        android:layout_alignParentRight="true"        android:layout_centerVertical="true"        android:background="@drawable/voice_max"/>


后来我尝试作了修改,如下

 <ImageView         android:id="@+id/voice_min"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_alignParentLeft="true"        android:layout_centerVertical="true"        android:background="@drawable/voice_min"/>    <ImageView         android:id="@+id/voice_max"        android:layout_height="wrap_content"        android:layout_width="wrap_content"        android:layout_alignParentRight="true"android:layout_centerVertical="true"        android:background="@drawable/voice_max"/>    <SeekBar         android:id="@+id/sb_voice"        android:layout_height="wrap_content"        android:layout_width="fill_parent"        android:layout_centerVertical="true"        android:layout_toLeftOf="@id/voice_max"        android:layout_toRightOf="@id/voice_min"        android:paddingLeft="5dp"        android:paddingRight="5dp"        android:background="@drawable/voice_seekbar_bg"        />


错误就消失了,原来toLeftOf和toRightOf的参数需要在使用它们之前定义,

刚开始只想着从左到右的顺序挨个写,显得有条理,看来我想多了.

错误就消失了,

更多相关文章

  1. Android中的Button自定义点击效果实例代码
  2. Unity Android打包apk安装错误INSTALL_FAILED_CONFLICTING_PROVI
  3. 建立一个简单的android涂鸦工程
  4. android 谷歌地图准备
  5. Android纠正Activity横竖屏切换的生命周期的错误
  6. Android设置支持多种分辨率
  7. android:multiprocess
  8. Android中VectorDrawableCompat的使用注意事项
  9. Android关于分屏的知识总结

随机推荐

  1. Android存在安全缺陷:可被黑客窃听和监视
  2. android recovery模式及ROM制作
  3. 浅谈J2me游戏如何快速移植到Android
  4. android仿摩拜单车APP、炫酷RecyclerView
  5. Android终端专项测试相关介绍
  6. 让Qt应用程序跑在Android上
  7. Android(安卓)轻松实现语音朗读
  8. 阿里ARouter路由实现Android模块化开发
  9. Android中View的getX,getY...
  10. 谷歌 Android(安卓)4.0 源代码公布,一起来