问题描述
在我的应用我使用XML来定义垂直虚线。
in my app I use XML defined vertical dotted line.
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="90"
android:toDegrees="90">
<shape
android:shape="line">
<stroke
android:width="1dp"
android:color="@color/light_gray"
android:dashWidth="2dp"
android:dashGap="4dp"
/>
</shape>
当我挑剔我的机器人工作室的布局,该行被渲染适当点缀,因为它应该,但问题来了,当我运行在实际设备应用程序。该生产线是刚刚固体,无gaps..Do你知道可能是问题?我尝试了许多不同的设备,包括那些运行最新的4.3 Android..It举目皆是一样的:/
When I am nitpicking my layout in Android Studio, the line is rendered properly dotted, as it should, but problem comes out when I run the app on real device. The line is just solid with no gaps..Do you know where could be the problem? I tried many different devices including those running latest 4.3 Android..It look everywhere the same:/
推荐答案
这是最有可能与硬件加速:虚线是不是GL模式下支持
This is most likely related to hardware acceleration: Dashed lines are not supported in GL mode.
其记录在这里:<一href="https://$c$c.google.com/p/android/issues/detail?id=29944">https://$c$c.google.com/p/android/issues/detail?id=29944
关闭您的硬件加速是这样的:
Turn off your HW-acceleration like this:
android:hardwareAccelerated="false"
或
myView.setLayerType(View.LAYER_TYPE_SOFTWARE, null)
这篇关于当应用程序是在真正的Android设备上运行虚线实际上不是点缀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!