android - How to change AppCompatButton corner radius? -


 <android.support.v7.widget.appcompatbutton                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:text="@string/logout" /> 

above button xml have small corner radius default need change radius little bit how can change corner radius?

use custom style: create following file drawable folder.

button_style.xml

<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android">     <item android:state_pressed="true" >         <shape>             <solid                 android:color="#9cd0e3" />             <stroke                 android:width="7dp"                 android:color="#55bde4" />             <corners                 android:radius="3dp" />             <padding                 android:left="10dp"                 android:top="10dp"                 android:right="10dp"                 android:bottom="10dp" />         </shape>     </item>     <item>         <shape>             <gradient                 android:startcolor="#55bde4"                 android:endcolor="#55bde4"                 android:angle="270" />             <stroke                 android:width="7dp"                 android:color="#9dd0e2" />             <corners                 android:radius="3dp" />             <padding                 android:left="10dp"                 android:top="10dp"                 android:right="10dp"                 android:bottom="10dp" />         </shape>     </item> </selector> 

example 2 (button_style.xml): corner radius.

<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android">     <item android:state_pressed="true" >         <shape>             <corners                 android:radius="15dp" />             <padding                 android:left="10dp"                 android:top="10dp"                 android:right="10dp"                 android:bottom="10dp" />         </shape>     </item>     <item>         <shape>             <corners                 android:radius="15dp" />             <padding                 android:left="10dp"                 android:top="10dp"                 android:right="10dp"                 android:bottom="10dp" />         </shape>     </item> </selector> 

and use this

<android.support.v7.widget.appcompatbutton         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_below="@+id/searchbox"         android:background="@drawable/button_style"         android:text="@string/logout" /> 

look @ android:radius="3dp" in button_style.xml.... increase dp as want..


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -