Reputation: 199
I have something like this.
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fb="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="@drawable/blue_bg"
tools:context="com.example.budgetme.MainActivity" >
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
How do make the "android:background="@drawable/blue_bg" transparent and the other buttons,Textviews,etc more darker and more "SEEN"
Thanks in advance
Upvotes: 1
Views: 2750
Reputation: 833
In your drawable-> blue_bg replace (say u use the following color code)
<solid android:color="#462D85" />
to
<solid android:color="#4D462D85" />
for 70% transparency
rest opaque values are---
100% — FF
95% — F2
90% — E6
85% — D9
80% — CC
75% — BF
70% — B3
65% — A6
60% — 99
55% — 8C
50% — 80
45% — 73
40% — 66
35% — 59
30% — 4D
25% — 40
20% — 33
15% — 26
10% — 1A
5% — 0D
0% — 00
Upvotes: 0
Reputation: 1453
One way is to define your blue_bg in the colors.xml file. For example:
<color name="blue_bg">#??3f51b5</color>
where ?? you can replace with hex according to transparency i.e.
100% — FF , 90% — E6 , 80% — CC , 70% — B3 , 60% — 99 , 50% — 80 , 40% — 66 , 30% — 4D , 20% — 33 , 10% — 1A , 0% — 00
I hope this helps.
Upvotes: 1
Reputation: 3322
try like this,
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fb="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.8"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="@drawable/blue_bg"
tools:context="com.example.budgetme.MainActivity" >
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
you can set more transparency by setting value android:alpha="0 to 1"
Upvotes: 1