android - Create a custom gradient with 2 shapes -
i want create gradient background in android. i've used angrytools.com generate these 2 shapes. not sure how implement them.
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:type="linear" android:centerx="100%" android:startcolor="#7f000000" android:centercolor="#ffffffff" android:endcolor="#ffffffff" android:angle="90"/> </shape> ------------------------------------------------- <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:type="radial" android:centerx="50%" android:centery="50%" android:startcolor="#7f000000" android:centercolor="#ffffffff" android:endcolor="#ffffffff" android:gradientradius="100"/> </shape>
try use layer-list create yourfile.xml in drawable folder that
<item> <layer-list> <item> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:type="linear" android:startcolor="#7f000000" android:centercolor="#ffffffff" android:endcolor="#ffffffff" android:angle="90"/> </shape> </item> <item> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:type="radial" android:centerx="0.5" android:centery="0.5" android:startcolor="#7f000000" android:centercolor="#ffffffff" android:endcolor="#ffffffff" android:gradientradius="100"/> </shape> </item> </layer-list> </item>
and use android:background="@drawable/yourfile.xml"
Comments
Post a Comment