1.链接

https://github.com/Devlight/ShadowLayout

  

2.效果

Android paint设置阴影 android imageview设置阴影_github

 

3.code

compile 'com.github.devlight.shadowlayout:library:1.0.2'

  

<com.gigamole.library.ShadowLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:sl_shadow_angle="2"
        app:sl_shadow_color="#000"
        android:id="@+id/sl"
        app:sl_shadow_distance="5dp"
        app:sl_shadow_radius="1dp"
        app:sl_shadowed="true">
        <ImageView
            android:layout_width="100dp"
            android:id="@+id/ls"
            android:layout_height="100dp"
            android:src="@mipmap/menu_stick" />
    </com.gigamole.library.ShadowLayout>

  

final ShadowLayout shadowLayout = (ShadowLayout) findViewById(R.id.sl);
        shadowLayout.setIsShadowed(true);
        shadowLayout.setShadowAngle(45);//阴影角度
        shadowLayout.setShadowRadius(20);//阴影半径
        shadowLayout.setShadowDistance(30);//阴影距离
        shadowLayout.setShadowColor(Color.DKGRAY);//阴影颜色