Carter Harrison
Carter Harrison

Reputation: 69

Custom Buttons Android

I want to have a very minimal button that is is just a black rectangular box around text. What's the easiest way to do this. Should I make images in Photoshop or just use styles? Can I use styles?

Upvotes: 0

Views: 62

Answers (2)

Rishad Appat
Rishad Appat

Reputation: 1806

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
 android:shape="rectangle" android:padding="10dp">
 <solid android:color="#00FFFFFF"/>
<stroke android:width="1dp" android:color="#000000" />
</shape>

create this drawable and set it as background of your button...

Upvotes: 1

Faiyaz
Faiyaz

Reputation: 572

You can use

<Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#000000"
        android:textColor="#ffffff"
        android:text="Button" />

in your layout file.

Upvotes: 0

Related Questions