GrallocAllocator unsupport colortype 6
GrallocAllocator decode bitmap failed, reset to heapAllocator
这是我得到的信息。你能告诉我我做错了什么吗?
private static final String KEY_INDEX = "index";
private static final String KEY_INDEX2 = "index2";
private static final String KEY_INDEX3 = "index3";
private static final String KEY_INDEX4 = "index4";
private static final String KEY_INDEX5 = "index5";
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.easy_quiz);
correctAnswerColor = getResources().getColor(R.color.correctAnswerButton);
incorrectAnswerColor = getResources().getColor(R.color.incorrectAnswerButton);
if(savedInstanceState != null) {
mCurrentIndex = savedInstanceState.getInt(KEY_INDEX, 0);
if(savedInstanceState.getBoolean(KEY_INDEX2, false)) {
mTrueButton.getBackground().setColorFilter(correctAnswerColor, PorterDuff.Mode.MULTIPLY);
}
if(savedInstanceState.getBoolean(KEY_INDEX3, false)) {
mTrueButton.getBackground().setColorFilter(incorrectAnswerColor, PorterDuff.Mode.MULTIPLY);
}
if(savedInstanceState.getBoolean(KEY_INDEX4, false)) {
mFalseButton.getBackground().setColorFilter(correctAnswerColor, PorterDuff.Mode.MULTIPLY);
}
if(savedInstanceState.getBoolean(KEY_INDEX5, false)) {
mFalseButton.getBackground().setColorFilter(incorrectAnswerColor, PorterDuff.Mode.MULTIPLY);
}
} (...)
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
Log.i(TAG, "OnSaveInstanceState");
outState.putInt(KEY_INDEX, mCurrentIndex);
outState.putBoolean(KEY_INDEX2, mIsTrueButtonGreen);
outState.putBoolean(KEY_INDEX3, mIsTrueButtonRed);
outState.putBoolean(KEY_INDEX4, mIsFalseButtonGreen);
outState.putBoolean(KEY_INDEX5, mIsFalseButtonRed);
}
我读到设置颜色最好使用getBackground.setColorFilter。不幸的是,在这种情况下它似乎不起作用。我该怎么做是问题。