Search This Blog

Tuesday, March 22, 2016

BUTTON - BO VIEN BUTTON ( TUY CHINH BUTTON )

- Tạo file custombutton.xml : 


<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
android:shape="rectangle">

    <corners android:radius="30dp"/>
    <padding android:left="5dp" 
        android:right="5dp" 
        android:top="5dp" 
        android:bottom="5dp"/>
    <solid android:color="#0cb10c"/>

</shape>

- Thêm background cho button (Nhúng file custombutton.xml vào button ) : 

<Button    

    android:layout_width="match_parent"    
    android:layout_height="wrap_content"    
    android:text="Shop Hoa Thiên Thảo"    
    android:textSize="20dp"    
    android:textStyle="bold"    
    android:background="@drawable/custombutton"
    android:id="@+id/button"    
    android:layout_marginBottom="62dp"    
    android:layout_alignParentBottom="true"    
    android:layout_alignParentLeft="true"    
    android:layout_alignParentStart="true"    
    android:layout_marginLeft="10dp"    
    android:layout_marginRight="10dp" />

No comments:

Post a Comment