Pankaj Khurana Pankaj Khurana - 5 days ago 4
Android Question

Display Issue in GridView (layout inflator) having button at the bottom of the screen?

I am using gridview with layout inflator to display icon with text with the difference that i have to provide a button at the bottom of the screen. My layout file looks like this:

<?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>


When I test it on the emulator (size according to the real device). Grid view is correctly populated but when I scroll to the last row the image is visible but not the text and button is hindering the view. I want the text to visible also. How can I achieve this?

enter image description here

Answer

Try This New Code I updated it and Checked also .........

<?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>
Comments