我想在HorizontalScrollView
中像ImageView
一樣顯示android市場。我遇到了ImageView
裏面的空間問題LinearLayout
,在這裏我得到:圖像分開很長不受控空間。ImageViews佔用了大量的空間(XML)
編輯:ScrollView
工作正常,只是想盡量減少圖像之間的距離和並排顯示圖像。
我希望它是這樣的:
這裏此行的xml
代碼:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TableRow
android:id="@+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="250dp"
android:background="#afafafaf" >
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout android:id="@+id/_linearLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">
<ImageView android:id="@+id/_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#000000"
android:src="@drawable/icon_2"
/>
<ImageView android:id="@+id/_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#000000"
android:src="@drawable/icon_2"
/>
</LinearLayout>
</HorizontalScrollView>
</TableRow>
<TableRow> </TableRow> <!-- ........ other table rows for other things -->
我認爲你的表格行和滾動視圖寬度應該設置爲'fill_parent'。現在的方式是,您的滾動視圖可能無法展開到所需的寬度。 – mkasberg
先生,滾動視圖擴展工作正常,我希望圖像之間的空間最小化 – Yousif