LinearLayout里面的GridViews?

时间:2012-10-31 03:13:07

标签: gridview android-linearlayout

我们如何在LinearLayout中定义GridView?我正在尝试遵循XML代码,但它不适合我。我是否必须在嵌套的LinearLayout中定义GridView?

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/parent_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >


<GridView 
    android:id="@+id/gridview"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:columnWidth="90dp"
    android:numColumns="auto_fit"
    android:verticalSpacing="10dp"
    android:horizontalSpacing="10dp"
    android:stretchMode="columnWidth"
    android:gravity="center"
/>

  <LinearLayout 
      android:id="@+id/droparea"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="center"
      android:orientation="horizontal"
      android:background="#ff00ff00">

<TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="@dimen/padding_medium"
        android:text="hello_world" />

  </LinearLayout>        


</LinearLayout>

0 个答案:

没有答案