Android的虚线绘制潜在ICS的bug [英] Android dashed line drawable potential ICS bug

查看:135
本文介绍了Android的虚线绘制潜在ICS的bug的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是虚线,以XML定义为ShapeDrawable:

 <形状
    的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:形状=行>

    <大小
        机器人:身高=2DP
        机器人:宽=700dp/>

    <中风
        机器人:宽=1DP
        机器人:颜色=@机器人:彩色/黑白
        机器人:dashWidth =1DP
        机器人:dashGap =2DP/>

< /形状>
 

这将利用几个姜饼手机一个不错的虚线。在Galaxy的Nexus然而,破折号似乎被忽略,形状绘制为连续的线。更好奇,运行ICS仿真器将正确呈现它与破折号,它只是物理设备搞砸了。

我失去了一些东西明显?还是这真的与Android 4.0中的错误?该生产线是用在几个地方。下面是一个例子ImageView的:

 < ImageView的
    机器人:layout_width =match_parent
    机器人:layout_height =WRAP_CONTENT
    机器人:layout_marginLeft =@扪/ observation_observe_side_margin
    机器人:layout_marginRight =@扪/ observation_observe_side_margin
    机器人:layout_marginTop =16DP
    机器人:contentDescription =@字符串/ dotted_line_description
    机器人:SRC =@可绘制/ dotted_line/>
 

解决方案

这个问题是这里<一个记录href="http://$c$c.google.com/p/android/issues/detail?id=29944">http://$c$c.google.com/p/android/issues/detail?id=29944关闭硬件加速将显示虚线。

The following is a dashed line, defined as a ShapeDrawable in XML:

<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="line">

    <size
        android:height="2dp"
        android:width="700dp" />

    <stroke
        android:width="1dp"
        android:color="@android:color/black"
        android:dashWidth="1dp"
        android:dashGap="2dp" />

</shape>

This will draw a nice dotted line on several Gingerbread phones. On the Galaxy Nexus however, the dashes appear to be ignored and the shape is drawn as a contiguous line. Even more curious, an emulator running ICS will render it correctly with the dashes, it's just the physical device screwing up.

Am I missing something obvious? Or is this really a bug with Android 4.0? The line is used in several places. Here is an example ImageView:

<ImageView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="@dimen/observation_observe_side_margin"
    android:layout_marginRight="@dimen/observation_observe_side_margin"
    android:layout_marginTop="16dp"
    android:contentDescription="@string/dotted_line_description"
    android:src="@drawable/dotted_line" />

解决方案

This issue is logged here http://code.google.com/p/android/issues/detail?id=29944 Turning off hardware acceleration will show the dashed line.

这篇关于Android的虚线绘制潜在ICS的bug的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆