GridView and ScrollView
GridView
ListView and GridView ScrollView is almost the same, and also the process of creating ListView like, you can refer to this blog post: https: //blog.csdn.net/Ace_bb/article/details/104066710
The difference is that with List'View different layout file attributes.
First look ListView interface layout previously created under:
A property numColumns
Add the following code layout file:
android:numColumns="3"
FIG interface effect:
it can be modified to show the number of columns by modifying the control digital numColumns behind.
This feature can be used for an album, the micro-channel QQ expression package list and the like .
numColumns may be provided an adaptive, set the number of columns of the system in accordance with the size of their control.
android:numColumns="auto_fit"
Their width may be set to the control, the number of columns to make the system adaptive, as follows:
android:columnWidth="50dp"
The distance between the two design attributes list control
List may be provided to control the distance between the control code is as follows:
android:horizontalSpacing="110dp"
android:verticalSpacing="110dp"
After setting results shown in Figure:
ScrollView
ScrollView not content area for scrolling list. Only supports vertical scrolling, scrollView controls which can only put a control, but you can add a LinearLayout, which joined in to LinearLayout other controls.
Here directly on the code:
<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>
The effect is as:
cover in this layout above, support scrolling.