为View添加阴影效果的工具类:ShadowViewHelper

jopen 9年前

介绍:

为View添加阴影效果的工具类。

运行效果:

使用说明:

xml:

<LinearLayout        android:id="@+id/activity_main_shadow_view_b"        android:layout_width="wrap_content" android:layout_height="wrap_content"        android:layout_gravity="center"        android:layout_marginTop="32dp"        android:orientation="vertical"        android:gravity="center"        android:padding="8dp"        >        <ImageView android:layout_width="match_parent" android:layout_height="match_parent"                   android:src="@mipmap/ic_launcher"                />        <TextView android:layout_width="match_parent" android:layout_height="match_parent"                  android:gravity="center"                  android:text="Shadow View with LinearLayout"                  android:textSize="15sp"                />  </LinearLayout>

Activity:

ShadowViewHelper.bindShadowHelper(      new ShadowProperty()          .setShadowColor(0x77000000)          .setShadowDy(ABTextUtil.dip2px(context, 0.5f))          .setShadowRadius(ABTextUtil.dip2px(context, 3))      , findViewById(R.id.activity_main_shadow_view_b));

项目主页:http://www.open-open.com/lib/view/home/1434357520958