Pan*_*ana 0 android android-layout android-gridview
我正在使用带有布局充气器的gridview来显示带有文本的图标,区别在于我必须在屏幕底部提供一个按钮.我的布局文件如下所示:
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/sdcard" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:verticalSpacing="10dp"
android:horizontalSpacing="10dp" android:numColumns="3"
android:stretchMode="columnWidth" android:gravity="center" android:background="#ffffff"/>
<RelativeLayout android:layout_width="match_parent"
android:layout_height="match_parent">
<Button android:text="submit" android:id="@+id/button"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:paddingTop="5dp">
</Button>
</RelativeLayout>
</merge>
Run Code Online (Sandbox Code Playgroud)
当我在模拟器上测试它(根据真实设备的大小).网格视图已正确填充,但当我滚动到最后一行时,图像可见,但文本和按钮不会阻碍视图.我希望文本也可见.我怎样才能做到这一点?
试试这个新代码我更新了它并检查了.........
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout android:id="@+id/rl1" android:layout_width="wrap_content" android:layout_height="wrap_content">
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/sdcard" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:verticalSpacing="10dp"
android:horizontalSpacing="10dp" android:numColumns="3"
android:stretchMode="columnWidth" android:gravity="center" android:background="#ffffff" android:layout_above="@+id/button"/>
<Button android:layout_width="fill_parent" android:id="@+id/button" android:paddingTop="5dp" android:layout_height="wrap_content" android:text="submit" android:layout_alignParentBottom="true"></Button>
</RelativeLayout>
</merge>
Run Code Online (Sandbox Code Playgroud)