gpt4 book ai didi

android - ScrollView 和 layout_weight ="1"?

转载 作者:行者123 更新时间:2023-11-29 16:14:22 28 4
gpt4 key购买 nike

我在 ScrollView 下有广告布局。为了防止 ScrollView 重叠广告布局,我必须使用

<ScrollView 
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" // <--- THIS!
>
//...scrollview content
</ScrollView>

<include layout="@layout/ads_468x60"/>

如果宽度和高度都设置为fill_parentlayout_weight是什么意思?

根据文档,如果 layout_heightlayout_width 都设置为 0dp,这应该不起作用,或者更准确地说,然后忽略 layout_weight。但是,在这个例子中,如果 ScrollView 中没有 android:layout_weight="1" 属性,底部广告布局将不会显示。

最佳答案

使用 android:layout_height="0dp"

android:layout_weight="1"告诉布局管理器填充所有可用空间。

关于android - ScrollView 和 layout_weight ="1"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10635307/

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