2
我已经得到了以下布局的XML文件:为什么我无法在GridView之后添加元素?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_layout" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical">
<GridView android:id="@+id/main_grid_screen"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:numColumns="auto_fit" android:verticalSpacing="30dp"
android:horizontalSpacing="10dp" android:columnWidth="90dp"
android:stretchMode="columnWidth" android:gravity="center" />
<Button android:id="@+id/clickable_area" android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/view_items_area" />
</LinearLayout>
GridView控件显示了完美的罚款;但是,它下面的Button完全没有。如果我将Button标签放在GridView上方,它就会出现。是什么赋予了?
当你把按钮放在上面时,gridview是否也会出现?这可能是因为你提供的fill_parent layout_width/heights,但这只是一个猜测。 – 2010-06-22 20:42:54
是;我做了一个原始帖子的编辑(我忘了SO讨厌括号) – GJTorikian 2010-06-22 20:43:53
Golly我觉得很愚蠢。将GridView的高度从fill_parent更改为wrap_content可以解决问题。 – GJTorikian 2010-06-22 20:45:04