Im trying to make transparent Buttons and editTexts, I'm using a custom xml file, it works on Android 5 as expected (all fields are indeed transparent), but when running the same app on the emulator using Android 4.1.1, these fields appear black.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
android:background="@android:color/transparent">
<stroke android:width="3px" android:color="#FFF" />
</shape>
How can the transparency effect be achieved on older android OS's?
Setting background as transparent is working api level 4.0 onwards add below line in your xml
android:background="@android:color/transparent"
or Try some thing like this
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/transparent" />
<stroke android:width="3px" android:color="#FFF" />
</shape>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With