abd*_*him 3 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>
Run Code Online (Sandbox Code Playgroud)

Kai*_*bhi 11
在你的scrollview xml - >中添加这一行
android:fillViewport="true"
Run Code Online (Sandbox Code Playgroud)
这样,如果layout_width&layout_height为 match_parent/fill_parent,则子布局可以全屏显示..在你的情况下,TableLayout将获得使用此行的完整大小..!请享用...!
| 归档时间: |
|
| 查看次数: |
14808 次 |
| 最近记录: |