Skip to content

Instantly share code, notes, and snippets.

@pacificregmi
Created January 21, 2016 08:56
Show Gist options
  • Save pacificregmi/80831025a274e0b37abb to your computer and use it in GitHub Desktop.
Save pacificregmi/80831025a274e0b37abb to your computer and use it in GitHub Desktop.
Android Button with Icon and Text - android_button_with_icon_text.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#d9a950"
android:drawableTop="@drawable/setting_icon"
android:paddingBottom="5dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="8dp"
android:text="\nButton"
android:textColor="#e8e9e9" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:background="#d9a950"
android:drawableTop="@drawable/comment_ic"
android:paddingBottom="5dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="8dp"
android:text="\nButton"
android:textColor="#e8e9e9" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#d9a950"
android:drawableTop="@drawable/sync_refresh_icon"
android:paddingBottom="5dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="8dp"
android:text="\nButton"
android:textColor="#e8e9e9" />
</LinearLayout>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="26dp"
android:background="#b2b419"
android:drawableRight="@android:drawable/sym_call_outgoing"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="36dp"
android:paddingTop="10dp"
android:text="\nButton with Right Icon"
android:textColor="#e8e9e9" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:background="#b2b419"
android:drawableLeft="@android:drawable/sym_call_outgoing"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="36dp"
android:paddingTop="10dp"
android:text="\nButton with Left Icon"
android:textColor="#e8e9e9" />
</LinearLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment