Android的虚线绘制潜在ICS的bug虚线、Android、bug、ICS

由网友(安如少年初如夢)分享简介:以下是虚线,以XML定义为ShapeDrawable:<形状的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android机器人:形状=行><大小机器人:身高=2DP机器人:宽=700dp/><中风机器人:宽=1DP机器人:颜色=@机器人:彩...

以下是虚线,以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/>
 

解决方案 iOS vs. Android ICS Hardware Accelerated Graphics Pipelines

这个问题是这里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.

阅读全文

相关推荐

最新文章