我有這樣的代碼如何設置顏色爲輔助繪製在進度條
pb = (ProgressBar) findViewById(R.id.progressBar1);
final float[] roundedCorners = new float[] { 5, 5, 5, 5, 5, 5, 5, 5 };
ShapeDrawable pgDrawable = new ShapeDrawable(new RoundRectShape(roundedCorners, null, null));
String MyColor = "#00FF00";
pgDrawable.getPaint().setColor(Color.parseColor(MyColor));
ClipDrawable progress = new ClipDrawable(pgDrawable, Gravity.LEFT, ClipDrawable.HORIZONTAL);
pb.setProgressDrawable(progress);
pb.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.progress_horizontal));
在這段代碼的問題是,對於進度繪製和二級進度繪製我有相同的顏色。
如何設置社會進步顏色?
你知道@color中的狀態選擇器是否被考慮在內嗎? – njzk2
@ njzk2它用於繪製背景,在其上繪製實際進度。 –