How to change background color in shapes of android? -


i need change background color of button using shapes.

`

<?xml version="1.0" encoding="utf-8"?/>     <selector xmlns:android="http://schemas.android.com/apk/res/android">         <item android:state_active="true">             <shape android:shape="rectangle">                 <solid android:color="@color/blue3"/>                 <stroke android:color="@color/white1" android:width="2dp" />                 <corners android:radius="8dp" />             </shape>         </item>     </selector> 

`

i trying set blue3 color using solid it's not appearing in view. please make me correct if trying incorrect way.

use file in drawable

<?xml version="1.0" encoding="utf-8"?> 

<item>    <layer-list >          <item>             <shape>                 <solid android:color="#d4d4d4"></solid>                 <corners android:radius="2dp"></corners>             </shape>         </item>         <item android:right="2dp" android:bottom="2dp" android:left="1dp" android:top="1dp">         <shape>                <solid android:color="#ff0000"></solid>                <corners android:radius="2dp"></corners>            </shape>        </item>    </layer-list> </item> 

, set button background drawable hope help!


Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -