我有一個活動,可能有超過活動的水平寬度的信息,有沒有辦法添加一個水平滾動條,以便用戶可以根據需要向左和向右滾動?有沒有辦法在一個帶有tablelayout的佈局上添加水平滾動條?
我activity_fuel.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
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"
<TableLayout android:id="@+id/TableLayout01" android:layout_width="fill_parent" android:layout_height="wrap_content" android:stretchColumns="0">
<TableRow
android:id="@+id/TableRow01"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/TextView01"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/cell_shape"
android:enabled="true"
android:scrollHorizontally="true"
android:text="@string/title_activity_address"
android:textStyle="bold"
android:width="100px" >
</TextView>
<TextView
android:id="@+id/textView02"
android:background="@drawable/cell_shape"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/title_activity_phone"
android:width="150px"
android:textStyle="bold">
</TextView>
<TextView
android:id="@+id/TextView03"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/cell_shape"
android:scrollHorizontally="true"
android:text="@string/title_activity_distance"
android:textStyle="bold"
android:width="100px" >
</TextView>
</TableRow>
</TableLayout>
</RelativeLayout>
我是相當新的Android開發,只是想有這些信息看起來有點入眼。
順便謝謝你的詳細答案,以及所有額外的信息。好東西。 – yams 2013-04-26 22:53:18