Android利用阴影让标题栏出现层次感
2017-07-14 20:31
197 查看
首先上两张图看看效果
没有阴影
是不是感觉死气沉沉的?有阴影
当当当当,层次感就出来啦,特别是标题栏下面有个列表框就更加骚气啦。实现方法
其实就是使用shape的gradient,然后在调用,我的这个标题栏是自己做的,布局代码在下面。<gradient android:angle="270" android:startColor="@color/colorRed" android:centerColor="@color/colorRed" android:centerY="0.9"></gradient>
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/colorWhite"> <TextView style="@style/normalFont" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="15dp" android:background="@drawable/t" /> </RelativeLayout>
android:angle=”270” 表示从上往下渐变
android:centerY=”0.9” 表示把中心Y轴偏移到很下面。
如果是Android自带的Theme,就像我用的就是Android自带的AppTheme风格,你去设置colorPrimary对应drawable文件程序是无法找到drawable资源的。
提示:创建shape文件的时候,记得如果是英文字母的话要写成小写,如果有大写也会编译错误的。
相关文章推荐
- 去除android控件滑动的时候出现的阴影
- Android 利用Toolbar打造统一风格的标题栏
- Android 获取 屏幕状态栏高度和标题栏高度 避免出现0的情况
- 移动web在ios和android下点击元素出现阴影问题
- Android利用贝塞尔曲线实现ScrollView滑动到顶部后阴影反馈效果
- 同时屏蔽ios和android下点击元素时出现的阴影
- Android 利用animation-list自定义progressbar动画出现图片平铺问题
- Android利用贝塞尔曲线实现ScrollView滑动到顶部后阴影反馈效果
- 移动web在ios和android下点击元素出现阴影问题
- android 标题栏颜色渐变和阴影
- android ScrollView滑动时出现的阴影如何去除
- 关于android自定义标题栏出现的问题总结
- Android中利用代码去除标题栏
- Android利用ksoap2调用Webservice出现org.ksoap2.serialization.SoapPrimitive错误
- Android 利用服务Service创建标题栏通知
- 【Android】利用服务Service创建标题栏通知
- Android 5.x新特性之利用CardView制造温和的阴影效果
- Android滑动到顶部和底部时出现的阴影如何去掉
- 移动web在ios和android下点击元素出现阴影问题
- Android中利用NetworkInfo判断网络状态时出现空指针(NullPointerException)问题的解决方法