Nothing Type in Kotlin

Add Material Shadow in Android

Recently we discuss about Kotlin Native and daily used kotlin code, today we are going to discuss about Google's Material Shadow library.

Add Material Shadow in Android

Material Shadow is a library for seamlessly integrating Material shadows. The library takes existing material shadows to next level by adding the following features :

  • Convex shadows : The shadows are not only rectangular or circular, they can take any convex shape depending on the view and its content.
  • Support for shadow offsets : The library allows developers to set X and Y offset for the shadows.
  • Support for shadow intensity : The library also has support for setting shadow intensity via shadowAlpha attribute.
  • Shadows for semi-transparent views : The library allows shadows for semi-transparent views.
  • Support for Async Shadow calculations : The library allows the operations to be async to avoid blocking the UI thread for long calculations.
  • Shadow animations : The library supports fade out animation for shadow.

How to use this library?

Just add the following dependency in your app’s build.gradle

dependencies {
compile 'com.sdsmdg.harjot:materialshadows:1.2.5'
}

Example Usage 1 (Simple)

XML

<com.sdsmdg.harjot.materialshadows.MaterialShadowViewWrapper
android:layout_width="match_parent"
android:layout_height="match_parent">

<ImageView
android:layout_width="130dp"
android:layout_height="130dp"
android:elevation="5dp"
android:src="@drawable/poly" />

</com.sdsmdg.harjot.materialshadows.MaterialShadowViewWrapper>

Result

Simple example of Material Shadow

See other example and full article here >> : Material Shadow for Android 

Comments