开发者

how to create custom button using gradient effects?

开发者 https://www.devze.com 2023-04-12 16:31 出处:网络
how to create such type of button baground using button selector ? i add button selector code hare please help me ..

how to create such

how to create custom button using  gradient effects?

type of button baground using button selector ? i add button selector code hare please help me ..

<item android:state_enabled="false">
     <shape>
        <gradient
            android:startColor="#B2D570"
            android:endColor="#79B903"
            android:angle="270" />
        <stroke
            android:width="1dp"
            android:color="#4C5E2E" />
        <corners
            android:radius="2dp" />
        <padding
            android:left="5dp"
            android:top="4dp"
            android:right="5dp"
            android:bottom="4dp" />
    </shape>
 </i开发者_StackOverflow社区tem>


this is the code for selector: this will be useful for u, name this file and put this in xml drawable folder,and set the background of ur button with this filename....

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

  <selector xmlns:android="http://schemas.android.com/apk/res/android">

      <item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/focused" />

      <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/focusedpressed" />

      <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/pressed" />

      <item android:drawable="@drawable/defaultbutton" />

  </selector>
0

精彩评论

暂无评论...
验证码 换一张
取 消