如何将BlurImageView的背景src从一个更改为另一个?

时间:2018-03-02 00:56:39

标签: android

public void serviceSuccess(Channel channel){

    progressDialog.hide();
    Item item = channel.getItem();
    int resources = getResources().getIdentifier("drawable/icon_" + item.getCondition().getCode(), null, getPackageName());
    Drawable weatherIcon = getResources().getDrawable(resources);
    imageView.setImageDrawable(weatherIcon);
    location.setText(service.getLocation());
    condiiton.setText(item.getCondition().getDescription());
    temperature.setText(item.getCondition().getTemperature() + "\u00B0" + channel.getUnits().getTemperature());

    blurImageView.setImageResource(0);
    if(item.getCondition().getDescription().contains("Cloud")){
       blurImageView.setImageDrawable(getResources().getDrawable(R.drawable.cloudy));
        blurImageView.setBlur(10);
    }else if(item.getCondition().getDescription().contains("Clear")){
        blurImageView.setImageDrawable(getResources().getDrawable(R.drawable.open_sky));
        blurImageView.setBlur(10);
    }else if(item.getCondition().getDescription().contains("Rain")){
       blurImageView.setImageDrawable(getResources().getDrawable(R.drawable.rainy));
        blurImageView.setBlur(10);
    }else if(item.getCondition().getDescription().contains("Snow")){
        blurImageView.setImageDrawable(getResources().getDrawable(R.drawable.snowy));
        blurImageView.setBlur(10);
    }else if(item.getCondition().getDescription().contains("Sun")){
        blurImageView.setImageDrawable(getResources().getDrawable(R.drawable.sunny));
        blurImageView.setBlur(10);
    }else{
        blurImageView.setImageDrawable(getResources().getDrawable(R.drawable.other));
        blurImageView.setBlur(10);
    }
}

在这里,我试图通过下面提到的条件更改BlurImageView的背景src。我错过了什么吗?

0 个答案:

没有答案