Advertisement

Android网格视图GridView

阅读量:

match_parent意味着当前控件的尺寸将与父布局保持一致,其大小由父布局进行确定

wrap_content则表示当前控件的尺寸将根据内部内容进行适配,其大小由控件所包含的内容决定


GridViewActivity以及对应的页面布局文件

复制代码
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="15dp"
    >
    
    <GridView
        android:id="@+id/gv"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:numColumns="3"
        android:horizontalSpacing="10dp"
        android:vertic

全部评论 (0)

还没有任何评论哟~