标签:android scrollview tablelayout
我希望ScrollView TableLayout与屏幕具有相同的高度,但是为什么表只占用屏幕的一半,而ScrollView正按照预期全屏显示.
我尝试将table和rows的高度更改为wrap_content,但显示相同的结果.同样将桌子的高度改变为固定高度(例如900dp)也不起作用.即使最后一行高度也没有显示完整的评级栏.似乎表格被迫具有特定的宽度.
如果我删除ScrollView,它的工作正常.
谁能请帮忙.
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:background="@drawable/border"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".EditEntry" >
<TableLayout
android:id="@+id/tableLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TableRow
android:id="@+id/tr3a"
android:padding="2.5dp"
android:background="@color/col1"
android:gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1" >
<TextView
android:id="@+id/lab_bookname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/bookname" />
<EditText
android:id="@+id/bookname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/definputtext2" />
</TableRow>
<TableRow
android:id="@+id/tr3"
android:padding="2.5dp"
android:background="@color/col2"
android:gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1" >
<TextView
android:id="@+id/lab_printname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/print_name" />
<EditText
android:id="@+id/printname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/definputtext2" />
</TableRow>
......................
......................
......................
</TableLayout>
</ScrollView>
解决方法:
在您的scrollview xml中添加此行 – >
android:fillViewport="true"
这使得子布局能够全屏显示,如果它是layout_width& layout_height是match_parent / fill_parent. .在你的情况下,TableLayout将获得使用此行的完整大小..!请享用…!
标签:android,scrollview,tablelayout 来源: https://codeday.me/bug/20190716/1478027.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。