2016-03-24 5 views
3

色合いを設定することは以前は23.2.0で行われていました。バージョンを23.2.1に変更すると、次のコードでImageViewsの色合いが変わっていません。DrawableCompat.setTint()はappcompat-v7で動作しなくなりました23.2.1

Iは

List<ImageView> statusStage = new ArrayList<>(); 

として定義される画像ビューのリストを持っていると私は、以下の方法を使用して、画像の色合いを更新します。

public void setStatusStage(int stageComplete, int colorOn) { 
    for (int i = 0; i < statusStage.size(); i++) { 
     ImageView ss = statusStage.get(i); 
     Drawable dr = DrawableCompat.wrap(ss.getDrawable()); 
     DrawableCompat.setTint(dr, colorOn); 
     print("stage Complete:" + stageComplete+", "+i); 
    } 
} 

setTintの設定方法は異なりますか? 新しいバージョンで動作させるには、コードを変更する必要がありますか?

このバグは、互換性のあるバージョンです。

compile 'com.android.support:appcompat-v7:23.2.1' 

答えて

0

setImageDrawable()に電話していないようです。

public void setStatusStage(int stageComplete, int colorOn) { 
    for (int i = 0; i < statusStage.size(); i++) { 
     ImageView ss = statusStage.get(i); 
     Drawable dr = DrawableCompat.wrap(ss.getDrawable()); 
     DrawableCompat.setTint(dr, colorOn); 
     print("stage Complete:" + stageComplete+", "+i); 
     ss.setImageDrawable(dr); //this part 
    } 
} 

私はまた、あなたが状態を表すためにsetTintList()の代わりsetTint()を使用することをお勧めします。

+1

バグはss.setImageDrawable(dr)で続きます。このバグは23.2.1で発生しますが、以前のバージョンでは発生しません。 –

関連する問題