我想将布局权重分配给ScrollView内的LinearLayout内的多个项目.但是,ScrollView忽略LinearLayout weightSum.
我的目标是将布局的权重分为2,1,1(总和为4),但这在ScrollView内部无法正常工作.
我该如何解决这个布局问题?
main.xml中
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="4">
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="2"
android:background="#FFFFFF" />
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
android:background="#000000" />
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="1"
android:background="#4B4B4B" />
解决方法:
我以前遇到过这个问题.只需在ScrollView中使用android:fillViewport =“true”,它就会填满屏幕.
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >
标签:android,android-layout
来源: https://codeday.me/bug/20190925/1817410.html
最后
以上就是魁梧小霸王最近收集整理的关于android 布局权重,android – 布局权重在ScrollView中不起作用的全部内容,更多相关android内容请搜索靠谱客的其他文章。
发表评论 取消回复