I am looking to obtain a layout like this:
I am trying to create a gridview item like the one used here for 'albums', but i am trying for a simpler version with just an image on top and text below it. Here is my XML code:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/relativelayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg_card"
>
<ImageView
android:id="@+id/imgIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/txtTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/imgIcon"
android:layout_alignTop="@+id/imgIcon"
android:layout_alignRight="@+id/imgIcon"
android:layout_alignBottom="@+id/imgIcon"
android:layout_margin="1dp"
android:gravity="center"
android:textColor="#000000" />
</RelativeLayout></FrameLayout>
Howver, when i do this, i get an image in the centre with with white spaces all around it and no text displayed. What is the correct layout to be used to obtain a griditem like shown in the image Thanks