I am having trouble applying a gradient background to a LinearLayout.
This should be relatively simple from what I have read but it just doesn\'t seem to work. For r
It is also possible to have the third color (center). And different kinds of shapes.
For example in drawable/gradient.xml:
This gives you black - gray - black (left to right) which is my favorite dark background atm.
Remember to add gradient.xml as background in your layout xml:
android:background="@drawable/gradient"
It is also possible to rotate, with:
angle="0"
gives you a vertical line
and with
angle="90"
gives you a horizontal line
Possible angles are:
0, 90, 180, 270.
Also there are few different kind of shapes:
android:shape="rectangle"
Rounded shape:
android:shape="oval"
and problably a few more.
Hope it helps, cheers!