toufik3119
toufik3119

Reputation: 115

Android custom Button style

how can I have a button style like this enter image description here

it is a background image or what? and how to have a single line in the middle?

Upvotes: 0

Views: 300

Answers (1)

LordRaydenMK
LordRaydenMK

Reputation: 13321

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="?android:attr/dividerHorizontal"
android:showDividers="middle">

<TextView android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:gravity="center"
    android:text="Hello World" />

<LinearLayout style="?android:attr/buttonBarStyle"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <Button style="?android:attr/buttonBarButtonStyle"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="One" />

    <Button style="?android:attr/buttonBarButtonStyle"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="Two" />
</LinearLayout>

Code by Roman Nurik here.

Upvotes: 1

Related Questions