remove white background of image in android

10,197

you can either set the background to null (android:background="@null") or use a transparent color (android:background="@android:color/transparent")

Share:
10,197
Miller
Author by

Miller

Updated on June 04, 2022

Comments

  • Miller
    Miller almost 2 years

    I added an innerimage inside a framelayout in android.But the thing is that i am getting a white colour background.I need to remove that white colour Background.Any help will be appreciated.....

    Screenshot is given below

    enter image description here

    xml file is given below

    <?xml version="1.0" encoding="UTF-8"?>
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
    
        <ImageView  
            android:id="@+id/imageView"
            android:layout_width="fill_parent" 
            android:layout_height="fill_parent" 
            android:scaleType="center"
             />
    
        <ImageView
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:layout_gravity="left"
            android:background="@null"
            android:maxWidth="-5dp"  
            android:maxHeight="-5dp"
            android:src="@drawable/driveimg"
             />
    
    </FrameLayout>
    
  • Miller
    Miller over 9 years
    i already added android:background="@null" and try android:background="@android:color/transparent"...but no change occurs
  • Blackbelt
    Blackbelt over 9 years
    than it means that the driveimg has not a transparent background
  • CoolMind
    CoolMind almost 5 years
    @Miller, in my case one image appeared below another, so android:background didn't solve the problem. That were Google Maps with their uiSettings?.isMyLocationButtonEnabled = true.