gpt4 book ai didi

ANDROID:加权线性列表按钮消失

转载 作者:行者123 更新时间:2023-11-29 18:21:57 26 4
gpt4 key购买 nike

我看过很多关于这个的帖子,也尝试过很多解决方案,但出于某种原因,没有任何效果。我只想让按钮共享相等的空间...请你看看我的 xml 代码,看看是否有问题?谢谢!

                                    

<ScrollView android:id="@+id/scrollview1"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:weightSum="120">
<Button android:id="@+id/btn_mission" android:layout_width="0dp"
android:layout_height="wrap_content" android:background="#8D8BB7"
android:layout_weight="20" android:text="Mission">
</Button>
<Button android:id="@+id/btn_news" android:layout_width="0dp"
android:layout_height="wrap_content" android:background="#8D8BB7"
android:layout_weight="20" android:text="News/Events">
</Button>
<Button android:id="@+id/btn_studentservices"
android:layout_width="0dp" android:layout_height="wrap_content"
android:background="#8D8BB7" android:layout_weight="20"
android:text="Student Services">
</Button>
<Button android:id="@+id/btn_facultyservices"
android:layout_width="0dp" android:layout_height="wrap_content"
android:background="#8D8BB7" android:layout_weight="20"
android:text="Faculty Services">
</Button>
<Button android:id="@+id/btn_staff" android:layout_width="0dp"
android:layout_height="wrap_content" android:background="#8D8BB7"
android:layout_weight="20" android:text="Staff">
</Button>
<Button android:id="@+id/btn_library" android:layout_width="0dp"
android:layout_height="wrap_content" android:background="#8D8BB7"
android:layout_weight="20" android:text="Library">
</Button>
</LinearLayout>
</ScrollView>
</LinearLayout>

编辑:这似乎与设置背景有关,我删除了背景,所有内容共享相等的空间,但您仍然必须滚动。

最佳答案

尝试删除 android:weightSum="120" 并将 android:layout_weight="20" 设置为 android:layout_weight="1" 在所有按钮上。

关于ANDROID:加权线性列表按钮消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4889512/

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