解决Android(安卓)5.0以上版本Button自带阴影效果的方法
16lz
2021-01-26
今天跟UI对界面,发现一个按钮使用系统自带的button会自动有一个阴影。然而在4.x上却没有这个问题。直觉就是因为MD导致的Android版本差异。
果断Google,在stackoverflow上找到了解决方案。
http://stackoverflow.com/questions/28756035/how-to-remove-button-shadow-android
关键一条代码
style=”?android:attr/borderlessButtonStyle”
属性解释
<Buttonandroid:id="@+id/button_send"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/button_send"android:onClick="sendMessage"style="?android:attr/borderlessButtonStyle" />
设置该属性就可以去掉自带的阴影。
该属性在API 11及以上可用。鉴于现在普遍都是API 14,所以可以放心使用。已在5.1和6.0上试过,没问题。
更多相关文章
- Android基础入门教程——8.1.3 Android中的13种Drawable小结 Par
- Andorid的学习路线
- 软键盘android:windowSoftInputMode属性
- shader移植到 android 失败问题 (遇到过的)
- android ui篇 自己写界面
- android 窗口背景透明方法
- Andriod Style属性
- Android(安卓)中FloatingActionButton(悬浮按钮)实例详解
- android属性系统--应用程序get和set