所附图片包含3 布局
- 相对布局
- 线性布局
- 线性布局
两个线性布局大小相同并且重叠。
我只想知道如何在相对布局内安排这两个线性布局,以便线性布局 1 和 线性布局 2 将具有 90% parent 高度。此外,线性布局 1 必须对齐到相对布局的顶部,而线性布局 2 必须对齐到相对布局的底部布局。
任何简单的工作解决方案将不胜感激。(我是 android studio 的新手)
最佳答案
来自 Android documentation :
<android.support.percent.PercentRelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
app:layout_heightPercent="90%"
android:layout_alignParentTop="true"/>
<LinearLayout
android:layout_width="match_parent"
app:layout_heightPercent="90%"
android:layout_alignParentBottom="true"/>
</android.support.percent.PercentRelativeLayout>
LinearLayouts 重叠的顺序对应于它们的定义顺序。
关于android - 如何在android中的相对布局内安排两个线性布局?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38421843/