Android渐变永远无法正常工作(始终绑定) [英] Android gradient NEVER works (always banding)

查看:65
本文介绍了Android渐变永远无法正常工作(始终绑定)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图添加(径向)渐变作为背景(在Android 4.0中),无论是作为背景图像还是以编程方式添加,但是它们都不起作用.我只能在模拟器中对其进行测试,但我猜它在4.0设备上是相同的.

I tried to add a (radial) gradient as background (in Android 4.0), either as background image or programmatically but none of them never works. I can only test it in emulator, but I guess it's the same on a 4.0 device.

这些解决方案不起作用:

These solutions don't work:

我想我还尝试了一些尝试,但是也许有人对如何建立工作渐变作为背景有一个想法?

I guess I tried some more things but maybe someone has an idea how to build a working gradient as background?

我当前的代码如下:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".SplashScreen">

    <ImageView
        android:id="@+id/imageViewLogo"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:contentDescription="@string/desc_string"
        android:scaleType="centerCrop"
        android:src="@drawable/background_image" />

</RelativeLayout>

和background_image.xml

and background_image.xml

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

推荐答案

显然,它只是模拟器.在真实的设备上看起来不错.

Obviously it's just the emulator. On a real device it looks good.

这篇关于Android渐变永远无法正常工作(始终绑定)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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