Android button shadow/margin top -
i have button , imageview in 1 line. button has margin top. , use simple background drawable.
part of xml code:
<linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_marginleft="20dp" android:layout_marginright="20dp" android:layout_margintop="20dp"> <textview android:layout_width="match_parent" android:layout_height="60dp" android:layout_weight="4" android:background="@color/main_green" android:text="@string/from" android:gravity="center" android:textsize="22dp" android:textcolor="@color/text_color_white"/> <button android:id="@+id/fromcitybutton" android:layout_width="match_parent" android:layout_height="60dp" android:layout_weight="1" android:hint="from" android:background="@drawable/button_blank_border"/> </linearlayout>
button background drawable code:
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape> <solid android:color="@color/main_background"/> <stroke android:width="1px" android:color="#000000" /> </shape> </item> </selector>
now part looks this:
but should this:
how should fix shadow/margin of button?
this should work
<textview android:layout_width="match_parent" android:layout_height="60dp" android:background="#008080" android:layout_weight="4" android:gravity="center" android:layout_gravity="center" <-------- android:text="is" android:textcolor="#ffffff" android:textsize="22dp" />
Comments
Post a Comment