android - 在 list 中定义 sdk-version 后色带解决方案被杀死

标签 android background gradient shapes

读者可以引用这个问题:android:dither="true" does not dither, what's wrong?

我也有色带......解决方案是为我的带有渐变的 png 图像创建一个别名(在 xml 中)并将抖动设置为“true”。 在我的 list 文件中指定 SDK 版本之前一直有效 <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8" /> ...

使用 Android 1.6(API 级别 4)和皮肤 WVGA800 的模拟器上再次出现色带

有人能解释一下为什么吗!?

项目文件:https://rapidshare.com/files/3429393846/Dithering.zip

--

我的布局和目标到它的背景(抖动的别名):

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/d_gradient_grey_dither">
<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello"
    />
</LinearLayout>

背景(d_gradient_grey_dither.xml):

<?xml version="1.0" encoding="utf-8"?>
<bitmap
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/d_gradient_grey"
    android:antialias="true"
    android:dither="true"/>

list 文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.test"
      android:versionCode="1"
      android:versionName="1.0">


    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".Main"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>

    <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8" />

</manifest>

在这里查看结果:

https://docs.google.com/document/d/1XNlR9DvXRvoyFYWVOe9wMARq0E60fkbrBy9ANADvPw4/edit?hl=fr&authkey=COvrv9EG

如果有帮助,项目文件:

https://docs.google.com/leaf?id=0B6Y0F7DEUPbPZTM5MDU0YzAtNjJiYi00NTU0LTlmNTAtMWJiZTJhNjBhYjA3&hl=fr

或(压缩)

https://rapidshare.com/files/3429393846/Dithering.zip

最佳答案

这就是我使用的,我已经通过 API 11 使用了。

/** -- Eliminates color banding -- **/

@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
Window window = getWindow();
window.setFormat(PixelFormat.RGBA_8888);
}

关于android - 在 list 中定义 sdk-version 后色带解决方案被杀死,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6028753/

相关文章:

android - 有没有办法让我下拉生成另一个下拉列表?

ios - 当我在 xcode 中更改 ImageView 的颜色时,它在 Storyboard 上没有改变,这是为什么?

css - JavaFX:文本区域背景颜色错误

c++ - Sobel 的梯度是什么意思?

java - 为什么我不能比较这两个字符串?

android - 在 Android 中实现 Nokia Here SDK

java - 无法在 Firestore 中禁用离线数据

html - 为悬停标题文本提供背景

java - 更改 JButton 渐变颜色,但仅针对一个按钮,而不是所有按钮

gradient - Jetpack 在图像顶部合成渐变图像