Sunday, October 20, 2013

Create custom button with round corner and shadow by XML

To create a button in Android app like this:


The layout XML:
<Button

    android:layout_width="match_parent"

    android:layout_height="80dip"

    android:background="@drawable/hi"

    android:text="@string/click_button"

    android:textColor="#999"

    android:textSize="18dip"

    android:textStyle="bold" />
The drawable file hi.xml:
<?xml version="1.0" encoding="utf-8"?>

    <layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

    <!-- Bottom 2dp Shadow -->

    <item android:bottom="11px" android:top="19px" android:left="10px" android:right="10px">

        <shape android:shape="rectangle" >

            <solid android:color="#ccc" />

            <corners android:radius="7dp" />

        </shape>

    </item>

    <!-- White Top color -->

    <item android:bottom="15px" android:top="15px" android:left="10px" android:right="10px">

        <shape android:shape="rectangle" >

            <solid android:color="#FFFFFF" />

            <corners android:radius="7dp" />

        </shape>

    </item>

</layer-list>

1 comment:

Enable HP Zbook Thunderbolt 3 Dock on Ubuntu

As mention in previously post, I installed Ubuntu on my HP ZBook. After two days used all things work just fine, but the Thunderbolt 3 Dock ...