在RelativeLayout的使用layout_above [英] Using layout_above in a RelativeLayout
本文介绍了在RelativeLayout的使用layout_above的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人能向我解释为什么ImageView的没有出现上述的LinearLayout?
Can someone explain to me why the ImageView is not appearing above the LinearLayout?
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/rev_main"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<!-- some stuff in here -->
</LinearLayout>
<ImageView
android:id="@+id/rev_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/arrow"
android:layout_above="@id/rev_main"
/>
</RelativeLayout>
我不明白这一点。
I don't get it.
推荐答案
这发生在你指定相对于另一个布局调整。我找到了解决办法是去另一个方向。
This happens when you specify alignment relative to another layout. The solution I found was to go the other direction.
相反,说的LinearLayout是ImageView的下方。
Instead of telling the ImageView to be above the LinearLayout, tell the LinearLayout to be below the ImageView.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/rev_main"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/rev_arrow">
<!-- some stuff in here -->
</LinearLayout>
<ImageView
android:id="@+id/rev_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/arrow"
/>
</RelativeLayout>
这篇关于在RelativeLayout的使用layout_above的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文