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的我多麼想通過代碼來改變漸變的圖片例如
不能難,可以嗎?