Reputation: 923
I am using a gridview to display a collection of items in the form of an image with a textview beneath them for their title.
The final item of collection of items is unique in the fact that it only has an image, no textview (this might be relevant).
At the moment I am finding that as soon as a row is created that has a normal item and an image only item in it, the textview is cutoff.
I have tried setting the min height and height of the items but it doesn't seem to affect the grid at all.
Grid:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:background="@drawable/Background"
android:id="@+id/root_layout"
android:padding="10dip"
android:layout_height="match_parent">
<GridView
android:id="@+id/connection_grid"
android:listSelector="@android:color/transparent"
android:horizontalSpacing="25dip"
android:stretchMode="columnWidth"
android:verticalSpacing="25dip"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
Grid Item:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="300dp">
<FrameLayout
android:id="@+id/screencap_layout"
android:layout_height="wrap_content"
android:background="@drawable/RowBorderBackground"
android:layout_width="wrap_content"
android:padding="1dip"
android:layout_centerHorizontal="true">
<ImageView
android:id="@+id/connection_icon"
android:layout_width="200dip"
android:layout_height="147dip"
android:background="@drawable/grid_view_selector"
android:scaleType="centerCrop" />
<RelativeLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/devicetype_layout"
android:background="@drawable/RowBorderBackground"
android:layout_gravity="right|bottom"
android:layout_marginBottom="-2dip"
android:layout_marginRight="-2dip"
android:padding="2dip">
<TextView
android:text="NA"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/device_type" />
</RelativeLayout>
</FrameLayout>
<TextView
android:id="@+id/connection_name"
android:text="Machine 1"
android:gravity="center"
android:textSize="18dip"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
Upvotes: 2
Views: 2502
Reputation: 446
Set some paddingBottom to gridview gridview class.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:background="@drawable/Background"
android:id="@+id/root_layout"
android:layout_height="match_parent">
<GridView
android:id="@+id/connection_grid"
android:listSelector="@android:color/transparent"
android:horizontalSpacing="25dip"
android:stretchMode="columnWidth"
android:verticalSpacing="25dip"
android:paddingBottom="20dip"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
Upvotes: 1