您的位置:首页 > 移动开发 > Android开发

解决android中使用shape文件画虚线不显示

2014-10-21 10:34 381 查看
shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:width="@dimen/dimen_1_dip"
android:color="#000000"
android:dashWidth="@dimen/dimen_10_dip"
android:dashGap="@dimen/dimen_10_dip" />
</shape>


定义shape文件如下



但是使用之后在真机上没有虚线效果

根据网上大神们的解释是使用hardwareAccelerate引起的渲染错误...解决方法如下:
1. 把这个Activity的硬件加速关了... manifest里 android:hardwareAccelerated="false"

2. 或者从View层级上把硬件加速关掉 view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

亲测有效,特此记录。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐