0

I have an imageView on top a map fragment and I want to create shadow around it to look outstanding but as you may know shadows in android need a background to be applied on while map is not a suitable background. So is there any way to achieve this shadow?

therealak12
  • 1,178
  • 2
  • 12
  • 26

2 Answers2

0

You can create CardView as wrapper for image view. Like that.

Or create a drawable and set to your image view as android:background. Like that.

Or check documentation.

Onix
  • 662
  • 3
  • 10
0

You can achieve it like this

<android.support.v7.widget.CardView
                    android:id="@+id/imgWrapper"
                    android:layout_width="80dp"
                    android:layout_height="80dp"
                    card_view:cardCornerRadius="5dp"
                    card_view:cardElevation="5dp">

                    <ImageView
                        android:id="@+id/image"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:src="@drawable/your_drawable" />
                </android.support.v7.widget.CardView>

Just place your imageView inside the card with having elevations like above.

Abid Khan
  • 2,451
  • 4
  • 22
  • 45
  • I dont't know how your are doing but the shadow should work both by using drawable or cardview whether its a map or any other layout as background. – Abid Khan Nov 16 '18 at 14:55