Android custom button margin -
i have custom button layout
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true"> <shape> <gradient android:startcolor="@color/pres1" android:endcolor="@color/pres2" android:angle="270" /> <stroke android:width="5dp" android:color="@color/stro3" /> <corners android:radius="5dp" /> <padding android:left="10dp" android:top="20dp" android:right="10dp" android:bottom="20dp" /> </shape> </item> <item android:state_focused="true"> <shape> <gradient android:endcolor="@color/focu1" android:startcolor="@color/focu2" android:angle="270" /> <stroke android:width="5dp" android:color="@color/stro2" /> <corners android:radius="5dp" /> <padding android:left="10dp" android:top="20dp" android:right="10dp" android:bottom="20dp" /> </shape> </item> <item> <shape> <gradient android:endcolor="@color/norm1" android:startcolor="@color/norm2" android:angle="270" /> <corners android:radius="5dp" /> <padding android:left="10dp" android:top="20dp" android:right="10dp" android:bottom="20dp" /> </shape> </item> </selector>
and below lay out
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/all_white"> <textview android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" android:textcolor="@color/all_red" /> <button android:id="@+id/mq_categories" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="browse quiz categories" android:background="@drawable/custom_button" /> <button android:id="@+id/mq_random" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="enter random quiz" android:background="@drawable/custom_button" /> </linearlayout>
following output generated
i need add margin between buttons, appreciated..
just way
<button android:id="@+id/mq_categories" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="browse quiz categories" android:background="@drawable/custom_button" android:layout_marginbottom="5dp"/>
this way set margin of 5 density independent pixels on bottom of first button.
Comments
Post a Comment