android - Non-Lollipop Material Flat Buttons -
i want material style flat buttons systems before lollipop. i'm using android 4.4.4 , play store looks following:
the buttons , icons neatly arranged in apps, games, books.
the more button shows buttons button without icon.
so how do cute buttons this, glow when clicked, have icon neatly arranged there, , have little rounded corners. using drawableleft doesn't work because icons big.
i'm guessing there's way put style sheet, because google seems quite consistently across other apps.
button without icon
<button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/sign_up" android:background="@drawable/action_button" android:textcolor="@color/primary_text" android:textappearance="?android:attr/textappearancemedium" android:layout_marginright="5dp" android:id="@+id/fl_btn_signup" />
in drawable can use action_button.xml
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="false"> <shape android:dither="true" android:shape="rectangle"> <corners android:bottomleftradius="3dp" android:bottomrightradius="3dp" android:topleftradius="3dp" android:toprightradius="3dp" /> <solid android:color="#689f38" /> </shape> </item> <item android:state_pressed="true"> <shape android:dither="true" android:shape="rectangle"> <corners android:bottomleftradius="3dp" android:bottomrightradius="3dp" android:topleftradius="3dp" android:toprightradius="3dp" /> <solid android:color="#80689f38" /> </shape> </item> </selector>
if want use icons buttons use android:drawableleft
in button xml or can take linearlayout
horizontal orientation & imageview
& textview
<linearlayout android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="5dp" android:gravity="center_vertical" android:background="@drawable/action_button"> //same xml <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/ic_apps_icon" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:text="apps" android:gravity="center" android:padding="5dp" android:textappearance="?android:attr/textappearancemedium" android:textcolor="#ffffff" /> </linearlayout>
Comments
Post a Comment