XML to beautify your Buttons etc in Android


XML to beautify your Buttons etc in Android
Make round.xml in your drawable folder.


<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false">
<shape android:shape="rectangle">
<solid android:color="#fa09ad"/>
</shape>
</item>
<item android:state_pressed="true">
<shape android:shape="oval">
<solid android:color="#58d585"/>
</shape>
</item>
</selector>

And Call this in your activity_main.xml like this:

<Button
android:layout_gravity="center"
android:layout_marginTop="250dp"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@drawable/round"
android:gravity="center_vertical|center_horizontal"
android:text="Play"
android:textColor="#fff" />
I Am Not The Owner Of These Code .I Merely Have Copied Them From Various Sources. The Only Thing I Did Is That I Am Going To Present Them In More Easy Way To Understand.

Comments

Popular posts from this blog

LED Blinking using 8051 Microcontroller and Keil C – AT89C51

Android Camera Example 2

Java Script to make text change text color