【发布时间】:2014-09-25 06:33:39
【问题描述】:
我在表格布局中动态添加表格行。当我同时使用垂直和水平滚动条时。由于水平滚动,我在布局中获得了一些空间。我的 xml 文件是-
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbars="none">
<HorizontalScrollView
android:id="@+id/horizontalScrollView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbars="none">
<TableLayout
android:stretchColumns="*"
android:id="@+id/main_table"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_width="match_parent">
</TableLayout>
</HorizontalScrollView>
</ScrollView>
</LinearLayout>
截图是-
我想从右侧删除那个空间。
【问题讨论】:
-
你试过
android:layout_weight="wrap_content"为你的TableLayout -
Anushka,我认为你必须设置 layout_width="match_parent"
-
请发布您的布局行 xml 文件
-
@SagarPilkhwal,@pratik-我试过了,但它不起作用。它仍在右侧占用空间。
-
@DigveshPatel-我不是通过 xml 文件动态添加表行。
标签: android horizontal-scrolling