Reputation: 79
I want to build a transparent ImageButton, I put these buttons in a SurfaceView. But when I put the code in XML, Eclipse returns an error. I don't know how to solve, any help will be appreciated.
<ImageButton android:id="@+id/previous"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/media_skip_backward"
android:background="@drawable/transparent">
</ImageButton>
Upvotes: 1
Views: 221
Reputation: 3796
You just try this types of code in your xml file
<ImageButton
android:id="@+id/previous"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:src="@drawable/media_skip_backward" >
Upvotes: 0
Reputation: 12695
you can use this
<ImageButton
android:id="@+id/previous"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:src="@drawable/media_skip_backward" >
</ImageButton>
Upvotes: 2
Reputation: 53600
My suggestion is in res/values create colors.xml file and add transparent color code in it. something like
<resources>
<color name="transparent">#00000000</color>
<color name="Black">#000000</color>
<color name="Trans_Black">#80000000</color>
<color name="Trans_Black_Darker">#BB000000</color>
</resources>
Now change your path to android:background="@color/transparent"
Upvotes: 0