Android textview over imageview with background transparent

10,106

Solution 1

I think you should use merge tag in xml of your layout.. For example Merge example

Solution 2

one possible way: add Framelayout as root and then add textview and imageview like this

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<ImageView  
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 

    android:scaleType="center"
    android:src="@drawable/golden_gate" />

<TextView
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_marginBottom="20dip"
    android:layout_gravity="center_horizontal|bottom"

    android:padding="12dip"

    android:background="#AA000000"
    android:textColor="#ffffffff"

    android:text="Golden Gate" />

 </FrameLayout>

Solution 3

You can use a FrameLayout as container and to overlay TextView on the ImageView and assign a background of lower alpha channel #AARRGGBB

Share:
10,106

Related videos on Youtube

PPShein
Author by

PPShein

Updated on October 06, 2022

Comments

  • PPShein
    PPShein over 1 year

    Please let me know how to add textview over imageview with background transparent as per image. Detail is I want to add two textview over imageview, one textview is title and the rest one is description. And background is transparent. Please help.enter image description here

  • Milon
    Milon over 7 years
  • hetsgandhi
    hetsgandhi almost 4 years
    Perfect. Worked for me!