我正在做與ScrollView
桌面佈局。在這個代碼GridView
也TableLayout
但我沒有得到ScrollView
GridView
。請幫助我。問題出在GridView
。scrollView無法在GridView與TableLayout與滾動查看
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbars="horizontal" >
<TableLayout
android:id="@+id/TableLayout1"
android:layout_width="532dp"
android:layout_height="257dp"
android:layout_gravity="right"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:scrollbarAlwaysDrawVerticalTrack="true"
tools:context=".Intcalc" >
<TableRow
android:id="@+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="10dp" >
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="To Date"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/edttodate"
android:layout_width="160dp"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="date"
android:onClick="selectDate" />
<ImageButton
android:id="@+id/imageButton2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="left"
android:onClick="selectDate"
android:src="@android:drawable/btn_star" />
</TableRow>
<GridView
android:id="@+id/gridView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:numColumns="3"
>
</GridView>
</TableLayout>
</ScrollView>
如何添加滾動視圖裏面的GridView – Andrio
你不能爲GridView控件或ListView添加滾動視圖,因爲他們已經有內置的滾動功能。 –
好吧,但我沒有得到gridview的滾動 – Andrio