/ /テーブルレイアウトで水平スクロールが必要-android、android-widget

テーブルレイアウトで横スクロールが必要 - android、android-widget

私は3列のテーブルレイアウトを持っています定義済み。ただし、2番目の列のテキストが大きいため、コンテンツは画面から消えます。だから私は水平スクロールバーを配置しようとしていました。しかし、できませんでした。

ターゲットとしてAndroid 1.5を使用しています。

テーブルレイアウトのXMLコード

<?xml version="1.0" encoding="utf-8"?>

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:scrollbars="horizontal"
android:layout_height="fill_parent"
android:layout_width="fill_parent">


<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:stretchColumns="0,1,2"
android:id="@+id/tLayout"
android:scrollbars="horizontal"

>
<TableRow
android:layout_width="fill_parent">
<TextView
android:padding="3dip"
android:gravity="left"
android:text="Name"
/>
<TextView
android:padding="3dip"
android:gravity="left"
android:text="Address"
/>
<TextView
android:padding="3dip"
android:gravity="left"
android:text="Age"
/>
</TableRow>
</TableLayout>
</ScrollView>

回答:

回答№1は1
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:scrollbars="vertical">

<HorizontalScrollView
android:layout_width="320px" android:layout_height="fill_parent">

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linlay" android:layout_width="320px"
android:layout_height="fill_parent" android:stretchColumns="1"
android:background="#000000"/>

</HorizontalScrollView>

</ScrollView>