gpt4 book ai didi

android - 线性布局内的两个框架布局

转载 作者:太空宇宙 更新时间:2023-11-03 11:49:26 25 4
gpt4 key购买 nike

这是我现在的代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<FrameLayout
android:id="@+id/tablet_locations_fragment_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<FrameLayout
android:id="@+id/tablet_locations_fragment_locations_fragment_list_container"
android:layout_width="match_parent"
android:layout_height="90dp" />

</LinearLayout>

我认为很明显,我希望底部框架布局为 90dp 高,顶部框架布局占据其余空间,但目前,上部框架布局占用了所有屏幕高度。我怎样才能解决这个问题?我尝试将 layout_height="wrap_content"用于上部框架布局,但它没有任何改变。

最佳答案

layout_weight 是你的 friend

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<FrameLayout
android:id="@+id/tablet_locations_fragment_fragment_container"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="0dp" />

<FrameLayout
android:id="@+id/tablet_locations_fragment_locations_fragment_list_container"
android:layout_width="match_parent"
android:layout_height="90dp" />

</LinearLayout>

关于android - 线性布局内的两个框架布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26807678/

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