0

I am new to Android development and I need to know if I can overlap an imageView and a TextView together into a button. It should be similar to the image that I've shared and I need to frame it in a GridLayout with 2 columns. If I use FrameLayout for each imageView and textView it becomes little complex, is there any alternative method?

sample image

sourav.bh
  • 467
  • 1
  • 7
  • 20
Harish V
  • 1
  • 1
  • 7

1 Answers1

0

Try this and run...if any error occurs please tell me I will help

 <?xml version="1.0" encoding="utf-8"?>
<GridLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
    <Button
            android:id="@+id/img_category"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/your_image"
            android:scaleType="centerCrop"
            android:textColor="@color/colorBlack"
            android:text="Title"
            android:textSize="25sp"/>

</GridLayout>
Mittal Varsani
  • 5,601
  • 2
  • 15
  • 27