When using a small gif to be used as a background tile for a layout, I have found that my buttons appear transparent which is NOT what I want and I have not set any transparency parameters either (unless the background gif is transparent?)
My XML is:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="2"
android:background="@drawable/backgroundrepeat"
>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
android:id="@+id/scrollview1"
android:layout_weight="2"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp">
<TextView
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:id="@+id/textview"
android:scrollbars="vertical"
android:textColor="@android:color/black"
/>
</ScrollView>
<Button android:text="Connect To Phidge开发者_StackOverflow社区t" android:id="@+id/connect_button" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:enabled="false"
android:layout_weight="0"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="@null"
></Button>
</LinearLayout>
And the drawable tile is:
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/original10"
android:tileMode="repeat"
/>
Can anyone help? Thanks
As per the Android developer documentation, it is quite clearly stated that using GIF images is discouraged.
While they don't elaborate on the reason - I'm assuming due to its multi-layering nature. But I've played with the GIF images and encountered unwanted errors similar to yours.
So I'd suggest you to export your GIF image to a PNG and try with that. You can use any tool like Gimp or IrfanViewer.
Ok. Than remove the tag:
android:background="@null"
That makes it transparent in the way you describe it.
add this tag in button
android:background="@android:drawable/btn_default"
精彩评论