Reputation: 1385
I am trying to make my background bitmap a little bit transparent so text could be a little bit more visible.
I am setting my background bitmap like this:
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:dither="true"
android:src="@drawable/bitmap"
android:tileMode="repeat" />
This way text is not visible at all. How can I make my bitmap transparent? Thank you!
Upvotes: 0
Views: 170
Reputation: 5028
In the layout file add set an ID to the root layout:
<LinearLayout android:id="@+id/background" android:background="...
And you can change the opacity of its background in the code:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout....);
View backgroundView = findViewById(R.id.background);
backgroundView.getBackground().setAlpha(50);
...
Upvotes: 1