Reputation: 433
I have a fragment with Google map
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="48dp"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignWithParentIfMissing="true"
tools:context="ru.travelpath.activity.MapsActivity"/>
And a button with shadow over map:
<!-- List button -->
<FrameLayout
android:id="@+id/listButton"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_gravity="end"
android:layout_marginEnd="16dp"
android:layout_marginTop="16dp"
android:background="@drawable/button_list"
android:onClick="openObjectsList"
android:elevation="15dp"
android:translationZ="5dp">
<ImageView
android:id="@+id/listButtonIcon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"
android:scaleType="center"
android:src="@drawable/list"
android:contentDescription="@string/list_objects" />
</FrameLayout>
And I don't understand why shadow is cropped on the bottom side:
How can I fix this?
upd: It is button_list xml, it's just a circle:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Larger blue circle in back -->
<item>
<shape android:shape="oval">
<solid android:color="@color/white_two"/>
<size
android:width="15dp"
android:height="15dp"/>
</shape>
</item>
</layer-list>
Upvotes: 0
Views: 116
Reputation: 11467
Just Add this line from your imageButton parent xml
android:layout_marginBottom="16dp" , since you didnt maintain the margin from both the sides
<FrameLayout
android:id="@+id/listButton"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_marginBottom="16dp"
android:layout_gravity="end"
android:elevation="15dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="16dp"
android:background="@drawable/button_list"
android:onClick="openObjectsList"
android:translationZ="5dp">
<ImageView
android:id="@+id/listButtonIcon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"
android:scaleType="center"
android:src="@drawable/list"
android:contentDescription="@string/list_objects" />
</FrameLayout>
This Line
android:layout_marginBottom="16dp"
as u can refer this post, how to add shadow to a button How to provide shadow to Button
Upvotes: 1