GridViewコントロールとScrollView
グリッドビュー
ListViewコントロールとGridViewのScrollViewはほぼ同じであり、また同様に、リストビューを作成するプロセスは、このブログ記事を参照することができます。https://blog.csdn.net/Ace_bb/article/details/104066710
違いはList'View異なるレイアウトファイル属性を持つものです。
以前の下に作成したレイアウトインタフェースまず見た目のリストビュー:
プロパティnumColumnsの
次のコードのレイアウトファイルを追加します。
android:numColumns="3"
図インターフェイス効果:
それはデジタルnumColumnsの後ろに制御を変更することによって、列の数を表示するように変更することができます。
この機能は、アルバム、マイクロチャネルQQ発現パッケージリスト等に使用することができます。
numColumnsのは、それらの制御の大きさに応じてシステムの列数を設定し、適応的に提供されてもよいです。
android:numColumns="auto_fit"
次のように彼らの幅は、システムの適応を作るために、コントロールに列の数を設定することができます。
android:columnWidth="50dp"
2つの設計間の距離は、リストコントロールの属性
リストは、制御コードとの間の距離を制御するために設けられていてもよい以下の通りであります:
android:horizontalSpacing="110dp"
android:verticalSpacing="110dp"
図に示した結果を設定した後:
ScrollView
リストをスクロールするためのScrollView内容ではないエリア。唯一の垂直方向のスクロール、制御のみを置くことができscrollViewコントロールをサポートしていますが、他のコントロールのLinearLayoutにに参加のLinearLayoutを、追加することができます。
ここでは直接コードに:
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/grid_view_button">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我是来自于ScrollView中的Button"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我是来自于ScrollView中的Button"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我是来自于ScrollView中的Button"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我是来自于ScrollView中的Button"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我是来自于ScrollView中的Button"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我是来自于ScrollView中的Button"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我是来自于ScrollView中的Button"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我是来自于ScrollView中的Button"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我是来自于ScrollView中的Button"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我是来自于ScrollView中的Button"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我是来自于ScrollView中的Button"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我是来自于ScrollView中的Button"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我是来自于ScrollView中的Button"/>
</LinearLayout>
</ScrollView>
:効果があるとして
サポートスクロール、上記のこのレイアウトでカバー。