vxh.viet
4/17/2018 - 3:21 AM

Fix Button's shadow get clipped

#How to fix Button's shadow get clipped

SOURCE, SOURCE

Sometimes the shadow of Android Button get clipped like this:

Fix that by include:

android:clipChildren="false"
android:clipToPadding="false"
android:paddingBottom="20dp"  

for example:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:clipChildren="false"
                android:clipToPadding="false"
                android:orientation="vertical"
                android:paddingBottom="@dimen/space_20">

    <Button
        android:id="@+id/btn_view_terms_of_use"
        android:layout_width="wrap_content"
        android:layout_height="@dimen/space_35"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_gravity="bottom|center"
        android:background="@drawable/bg_white_border_green_conner"
        android:paddingLeft="@dimen/space_15"
        android:paddingRight="@dimen/space_15"
        android:text="@string/frag_terms_and_conditions_view"
        android:textAllCaps="true"
        android:textColor="@color/greyish_brown_two"
        android:textSize="@dimen/text_12"/>
</RelativeLayout>