android 使用shape绘制虚线时,在4.0机型上显示实线
2014-09-10 19:24
417 查看
在利用shape绘制虚线时,在Graphical Layout中能正常显示,但在Android4.0上的机型显示成了实线,
dotted_line.xml:
在网上搜索了下,发现是4.0以上默认把Activity的硬件加速打开了,所以我们再Manifest.xml中关掉即可
ok,现在虚线应该就可以正常显示了
也可以通过从View层级上把硬件加速关掉 view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);(这个方法暂时没有试过,添加在此记录下)
参考:http://www.eoeandroid.com/thread-539394-1-1.html
dotted_line.xml:
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line" > <stroke android:dashGap="4dip" android:dashWidth="10dip" android:width="1dip" android:color="@android:color/darker_gray" /> <size android:height="2dip"/> </shape>
在网上搜索了下,发现是4.0以上默认把Activity的硬件加速打开了,所以我们再Manifest.xml中关掉即可
<activity ... android:hardwareAccelerated="false"/>
ok,现在虚线应该就可以正常显示了
也可以通过从View层级上把硬件加速关掉 view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);(这个方法暂时没有试过,添加在此记录下)
参考:http://www.eoeandroid.com/thread-539394-1-1.html
相关文章推荐
- 【Android使用Shape绘制虚线,在4.0以上的手机显示实线】解决方案
- 【Android使用Shape绘制虚线,在4.0以上的手机显示实线】解决方式
- 关于Android使用 share绘制虚线却在手机上显示实线问题
- Android share绘制虚线在手机上显示实线问题
- 【转】Android Shape绘制虚线在手机端查看是实线的问题
- 4.0以上版本通过shape画虚线会显示实线
- 解决android中使用shape文件画虚线不显示
- android开发中解决shape画虚线时,在手机上显示实线的问题
- Android中常常使用shape来定义控件的一些显示属性,今天看了一些shape的使用,对shape有了大体的了解,稍作总结: 先看下面的代码: <shape>
- Android shape的使用实现圆角,虚线,渐变等效果
- Android 画虚线显示实线的BUG
- Android利用shape绘制虚线无效的解决办法
- android用shape画虚线,怎么也不显示
- Android使用shape设置虚线、圆角、渐变
- Android中常常使用shape来定义控件的一些显示属性
- Android画虚线却显示为实线的解决方法
- Android 4.0 4.2 不能显示电池使用信息
- android游戏开发框架libgdx的使用(三)--中文显示与汉字绘制
- android游戏开发框架libgdx的使用(三)--中文显示与汉字绘制
- android游戏开发框架libgdx的使用(三)--中文显示与汉字绘制