模糊1dip形线(边框)在Android [英] Blurred 1dip shape lines (borders) on Android

查看:708
本文介绍了模糊1dip形线(边框)在Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的应用程序的截图:

Here is the screenshot from my app:

这是一个从拍摄三星Galaxy Note 10.1( MDPI 149 PPI )。

It's taken from Samsung Galaxy Note 10.1 (mdpi 149 ppi).

我的客户认为,围绕底部的按钮和圆角矩形边界线之上模糊。

My client thinks that the border line around bottom buttons and rounded rectangle above are blurred.

我使用形状作为背景,看起来是这样的:

I'm using shape as a background which looks like this:

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle"
    >
    <corners
        android:radius="8dp" />

    <stroke android:width="1dp" android:color="@color/dark_gray" />

    <solid android:color="@color/sepia_bright" />

</shape>

当我用简单的视图与1DP高度这样一行:

When I use simple view as a line with 1dp height like this:

<View
    android:background="@color/bright_gray"
    android:layout_width="match_parent"
    android:layout_height="1dp" />

这是完全锐利,你可以在下一个截图中看到:

It's perfectly sharp as you can see on next screenshot:

简单的水平线是好的,但各地图的矩形再次模糊了。

Simple horizontal lines are ok, but rectangle around graph is blurred again.

我在做什么错了?

感谢您的帮助。

推荐答案

我的第一个猜想是,这与双线性过滤的问题(的 http://en.wikipedia.org/wiki/Bilinear_filtering )。

My first guess would be that this is a problem with bi-linear filtration (http://en.wikipedia.org/wiki/Bilinear_filtering).

要修复它,请参阅<一个href=\"http://developer.android.com/reference/android/view/View.html#setLayerType%28int,%20android.graphics.Paint%29%20%22View#setLayerType\"相对=nofollow>查看#setLayerType 方法。

To fix it, see The View#setLayerType method.

我在自定义视图曾与这个问题。里面我的看法的init方法,我有以下的code:

I had an issue with this in a custom view. Inside my view's init method, I have the following code:

    if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB){
        this.setLayerType(View.LAYER_TYPE_SOFTWARE, null);          
    }

这固定我的问题,但你可以使用机器人做同样的事情:layerType XML属性,或 setLayerType 在code方法对你的看法。

This fixed my issue, but you could do the same thing using the android:layerType xml attribute, or the setLayerType method in code on your view.

这篇关于模糊1dip形线(边框)在Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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