為View添加陰影效果的工具類:ShadowViewHelper
介紹:
為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));
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!