Simply, how to make a TextView transparent? (Not full transparency)
I searched the docs and the StackNetwork and couldn't find it? I guess there is something like this.
Thanks.
UPDATE
This is the XML code:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
android:background="@drawable/background">
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/header"
android:src="@drawable/logo1"
/>
<ListView android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:paddingRight="5dp"
android:scrollbarStyle="outsideOverlay"
android:cacheColorHint="#00000000" />
<TextView
android:id="@+id/footer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="25sp"
android:singleLine="true"
android:background="#07000000"
android:textColor="#FFFFFF"
android:text="rrrrr" />
</LinearLayout>
I want the footer TextView
to be transparent so that the ListView items can be seen while scrolling
To set programmatically:
For me, I also had to set it to Color.TRANSPARENT on the parent layout.
<TextView android:alpha="0.3" ...
, for example.Use this:
Below code for black:-
Now if i want to use opacity than you can use below code :-
and below for opacity code:-
Hex Opacity Values
refer Understanding colors on Android (six characters)
See the Android Color resource documentation for reference.
Basically you have the option to set the transparency (opacity) and the color either directly in the layout or using resources references.
The hex value that you set it to is composed of 3 to 4 parts:
Alpha (opacity), i'll refer to that as aa
Red, i'll refer to it as rr
Green, i'll refer to it as gg
Blue, i'll refer to it as bb
Without an alpha (transparency) value:
or as resource:
With an alpha (transparency) value:
or as resource:
The alpha value for full transparency is 00 and the alpha value for no transparency is FF.
See full range of hex values below:
You can experiment with values in between those.
Hi Please try with the below color code as textview's background.
android:background="#20535252"