ghumdan16
ghumdan16

Reputation: 37

Button creation in android curved sides

How can i create exactly the same buttons as shown in android?

I am a new learner, and I am creating an application that calculates tips. how can i make buttons round on left and right sides?

Upvotes: 1

Views: 560

Answers (1)

Arun Inbasekaran
Arun Inbasekaran

Reputation: 307

In your xml add background for your button.

          <Button
            android:id="@+id/login_loginbt"
            android:layout_width="fill_parent"
            android:text="Login"
            android:textColor="#ffffff"
            android:background="@drawable/curve_button"
            android:textSize="18dp"
            android:textStyle="bold" />

Then create a new xml "curve_button.xml"and paste this code for curve edged buttons.

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
 <item >
    <shape android:shape="rectangle"  >
        <corners android:radius="25dip" />
        <stroke android:width="1dip" android:color="#ff0000" />
        <gradient android:angle="-90" android:startColor="#ff0000" android:endColor="#ff0000" />
    </shape>
</item>

Upvotes: 2

Related Questions