gpt4 book ai didi

android - 如何填充 RelativeLayout 中两个 View 之间的空间

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:26:05 29 4
gpt4 key购买 nike

我有两种看法。顶 View 设置为...

 android:layout_alignParentTop="true"

底部设置为...

 android:layout_alignParentBottom="true"

如何用第三个 View 填充剩余空间?根据这个答案 here ,我应该使用这样的框架布局......

<FrameLayout 
android:layout_below="@+id/toplayout"
android:layout_above="@+id/bottomlayout"/>

但是我需要指定高度和宽度。我应该指定什么高度和宽度?

最佳答案

这是我的解决方案

<RelativeLayout
...
>
<YourLayout
android:id="@+id/toplayout"
android:layout_alignParentTop="true"
/>

<YourLayout
android:id="@+id/bottomlayout"
android:layout_alignParentBottom="true"
/>

<MiddleLayout
<!-- in your case it is FrameLayout -->
android:layout_width="match_parent"
android:layout_height="match_parent"
<!-- or android:layout_height="wrap_content" according to the_profile -->
android:layout_below="@+id/toplayout"
android:layout_above="@+id/bottomlayout"/>
</RelativeLayout>

希望对你有帮助

关于android - 如何填充 RelativeLayout 中两个 View 之间的空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33747668/

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