Is it really to implement elevation of ImageView with png that contains transparent background? For example: i want to add elevation shadow to this pic:
Want make it like this:
To set the default (resting) elevation of a view, use the android:elevation attribute in the XML layout. To set the elevation of a view in the code of an activity, use the View. setElevation() method. To set the translation of a view, use the View.
Elevation (Android) Elevation is the relative depth, or distance, between two surfaces along the z-axis. Specifications: Elevation is measured in the same units as the x and y axes, typically in density-independent pixels (dp).
In addition, box shadows in React Native are also not supported on Android, based on this. Save this answer. Show activity on this post. As per @rclai Answer, You cannot change the Elevation color in Android.
In your XML add this:
android:elevation="2dp"
android:background="@drawable/myrect"
In your Drawable folder add this drawable:
<!-- res/drawable/myrect.xml -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#42000000" />
<corners android:radius="5dp" />
</shape>
See here for more info: http://developer.android.com/training/material/shadows-clipping.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With