我使用下面的代码设置了migrationdrawable来改变颜色,但我想从左到右改变颜色。我该怎么做?
final Button b=(Button)findViewById(R.id.button);
//Let's change background's color from blue to red.
ColorDrawable[] color = {new ColorDrawable(Color.BLUE), new ColorDrawable(Color.RED)};
TransitionDrawable trans = new TransitionDrawable(color);
//This will work also on old devices. The latest API says you have to use setBackground instead.
b.setBackgroundDrawable(trans);
trans.startTransition(1500);