Android(安卓)5.0 MaterialDesign Ripple效果水波纹效果
16lz
2021-12-04
在Android 5.X的UI射击Material Design中,更是使用了大量的动画效果,同事Google也在官方文档上增加了对动画的设计指导。
Ripple效果
在Android 5.0后,material Design大量使用了Ripple效果,那就是点击后的波纹效果。
//波纹有边界
android:background=”?android:attr/selectableItemBackground”
//波纹超出边界
android:background=”?android:attr/selectableItemBackgroundBorderless”
在Drawable里面创建XML实现Ripple效果
<?xml version="1.0" encoding="utf-8"?><ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="@color/text_sub_other_color"> <item> <shape android:shape="rectangle"> <solid android:color="?android:colorAccent"/> shape> item>ripple>
使用方法所示
"@+id/ll_home" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:background="@drawable/bg_ripple_btn" android:gravity="center" android:orientation="vertical"> "@+id/tv_home_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/dp_2" android:drawablePadding="@dimen/dp_3" android:drawableTop="@drawable/main_bottom_tab_home" android:text="@string/menu_text_home" android:textColor="@drawable/event_select_text" android:textSize="@dimen/font_size_12"/> </LinearLayout>
如果觉得我的文章对您有用,请点顶。您的支持将鼓励我继续码蛋!
更多相关文章
- Android学习之 UI效果
- android手势操作滑动效果触摸屏事件处理
- android UI进阶之弹窗的使用(2)--实现通讯录的弹窗效果
- Android中利用GridView实现水平和垂直均有滚动条的表格效果
- LottieAnimationView 使用无法显示效果
- android 按钮背景色的渐变效果实现
- Android之——史上最简单最酷炫的3D图片浏览效果的实现
- android之字体阴影效果
- android资讯类软件框架