Design Attractive buttons via xml-1

by Thursday, April 19, 2012 0 comments

Copy & Paste the below code to drawable folder to create attractive buttons

<?xml version="1.0" encoding="UTF-8"?>
<shape  xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="rectangle">
                            <gradient 
            android:startColor="@color/btngreen"
            android:endColor="@color/btngreen1"
            android:angle="90"
         />
        <corners    android:bottomLeftRadius="5dip"
                android:topRightRadius="5dip"
                android:topLeftRadius="5dip"
                android:bottomRightRadius="5dip"/>
</shape>

Then in your layout Button field, set background for button & see the attractive buttons thru xml

        <Button
            android:id="@+id/attractivebtn"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:clickable="true"
            android:gravity="center"
            android:paddingLeft="15dp"
            android:paddingRight="15dp"
            android:paddingTop="8dp"
            android:paddingBottom="8dp"
            android:textColor="#ffffff"
            android:background="@drawable/btn_bgg"
            android:text="Button" />


Now you get attractive buttons.



karthik nagarajan

Androider

Welcome to Android-Action Blog. I’m a normal guy, who is passionate about Mobile Coding. Here I am writing about Android. Happy learning

0 comments:

Post a Comment