【发布时间】:2018-03-11 09:35:37
【问题描述】:
我正在使用 Android XML 进行布局,我想在布局底部添加一个按钮,并在其上方添加整个 GridView,但我无法做到! 不知道为什么... 谁能帮帮我?
这是我的 XML 代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/btn"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:textAllCaps="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<GridView
android:layout_above="@+id/btn"
android:fadeScrollbars="true"
android:id="@+id/PhoneImageGrid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnWidth="90dp"
android:horizontalSpacing="8dp"
android:numColumns="auto_fit"
android:stretchMode="columnWidth"
android:smoothScrollbar="true"
android:scrollingCache="false"
android:animationCache="false"
android:verticalSpacing="8dp" />
</RelativeLayout>
【问题讨论】:
-
完整布局显示 gridView ??
-
是的,绝对的!
-
android:layout_alignParentEnd="true" android:layout_alignParentStart="true"尝试从按钮中删除这两行 -
否则你可以使用按钮
below并在 Gridview 上删除above -
什么也没发生 :(
标签: android xml button gridview