3
EDIT线性GradientDrawable的变化中心:看溶液上方机器人:通过代码
I M再用了。我只想设置一个线性GradientDrawable,它改变了渐变的垂直中心...绘制渐变效果很好,但我怎样才能改变它的中心?!?
RelativeLayout bgScreen = (RelativeLayout) findViewById(R.id.player_screen);
GradientDrawable gd = new GradientDrawable(
GradientDrawable.Orientation.TOP_BOTTOM,
new int[] {startColor,endColor});
gd.setCornerRadius(0f);
gd.setAlpha(200);
bgScreen.setBackground(gd);
public void redrawOrChangeBackgroundGradient(){
//??? either change center of existing
gd.setGradientCenter(float x, float y) //ONLY works in RADIAL_GRADIENT or SWEEP_GRADIENT.
//??? or complete redraw Gradient with different center
}
这里S的我多么想通过代码来改变渐变的图片例如
不能难,可以吗?