gpt4 book ai didi

android - 无法让渐变背景看起来不错?

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:38:58 27 4
gpt4 key购买 nike

我已经尝试了所有方法,并搜索了整个网络,但仍然没有任何效果。
这是我的设计师设计的背景:
enter image description here

这是它在我的屏幕上的样子 (Galaxy S I9000):
enter image description here

我已尝试使用此代码启用抖动:

findViewById(R.id.LinearLayout_Main).getBackground().setDither(true);
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
Window window = getWindow();
window.setFormat(PixelFormat.RGBA_8888);
}

谁能告诉我为什么?

最佳答案

我认为,这篇文章对您来说会很有趣:

Android perfect UI: fighting with dithering

你也可以在 SO 上阅读抖动背景

android:dither="true" does not dither, what's wrong?

最后的建议来自 Android Google Groups

https://groups.google.com/group/android-developers/browse_thread/thread/aebef48635d04334/2e3d86e62e0452e5?lnk=gst&q=dithering#2e3d86e62e0452e5

使用 gradient proxy drawable shape 而不是像这样的 @drawable/image:

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

关于android - 无法让渐变背景看起来不错?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7639078/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com