1

I'm using a image in my app, that I know is transparent background PNG. In android studio it prerenders it correctly, but in the VM it gets a whit background.. Any one has any idea what Im doing wrong?

My xml snippet;

<ImageView
    android:id="@+id/fullscreen_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scaleType="centerInside"
    android:background="@android:color/transparent"
    android:adjustViewBounds="true"
    android:gravity="center"
    android:src="@drawable/jlogo2"
 />

From

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent" android:background="#ff19cc00"
    tools:context=".FullscreenActivity">

    <!-- The primary full-screen view. This can be replaced with whatever view
         is needed to present your content, e.g. VideoView, SurfaceView,
         TextureView, etc. -->


    <ImageView
        android:id="@+id/fullscreen_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="centerInside"
        android:background="@android:color/transparent"
        android:adjustViewBounds="true"
        android:gravity="center"
        android:src="@drawable/jlogo2"
     />


    <!-- This FrameLayout insets its children based on system windows using
         android:fitsSystemWindows. -->
    <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent"
        android:fitsSystemWindows="true">

        <LinearLayout android:id="@+id/fullscreen_content_controls" style="?metaButtonBarStyle"
            android:layout_width="match_parent" android:layout_height="wrap_content"
            android:layout_gravity="bottom|center_horizontal"
            android:background="@color/black_overlay" android:orientation="horizontal"
            tools:ignore="UselessParent">


            <Button android:id="@+id/dummy_button" style="?metaButtonBarButtonStyle"
                android:layout_width="0dp" android:layout_height="wrap_content"
                android:layout_weight="1" android:text="@string/dummy_button" />

        </LinearLayout>
    </FrameLayout>

</FrameLayout>
NicklasN
  • 484
  • 1
  • 7
  • 20

1 Answers1

1

Try

android:background="@null"

in your ImageView

Jikiwiki
  • 29
  • 2
  • I tried that, it just gets black where the image would be. :( – NicklasN May 14 '15 at 13:11
  • Try to make it an imagebutton that has " – Jikiwiki May 14 '15 at 21:39
  • 1
    That works, but as soon as I change it to my PNG it gets a white background again.. And I have checked twice now in photoshop for a background on the PNG and for all PS is concerned its transparent. – NicklasN May 15 '15 at 08:00