gpt4 book ai didi

android - 如何在android中的相对布局内安排两个线性布局?

转载 作者:行者123 更新时间:2023-11-30 01:11:03 24 4
gpt4 key购买 nike

所附图片包含3 布局

  1. 相对布局
  2. 线性布局
  3. 线性布局

两个线性布局大小相同并且重叠

我只想知道如何在相对布局内安排这两个线性布局,以便线性布局 1线性布局 2 将具有 90% parent 高度。此外,线性布局 1 必须对齐到相对布局的顶部,而线性布局 2 必须对齐到相对布局的底部布局。

任何简单的工作解决方案将不胜感激。(我是 android studio 的新手)

enter image description here

最佳答案

来自 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com