0

プログレスバーの色をカラーで使用可能な色(青、緑など)に正常に変更しましたが、特定の色の16進コードを指定すると、何も含まれていないバーが表示されます。どうすればこれを解決できますか?

ProgressBar pg = (ProgressBar)findViewById(R.id.progressBarDownload);
final float[] roundedCorners = new float[] { 5, 5, 5, 5, 5, 5, 5, 5 };
ShapeDrawable progressDrawable = new ShapeDrawable(new RoundRectShape(roundedCorners, null,null));
progressDrawable.getPaint().setColor(0x01060012);//<-----problem here?
ClipDrawable progress = new ClipDrawable(progressDrawable, Gravity.LEFT, ClipDrawable.HORIZONTAL);
pg.setProgressDrawable(progress);   
pg.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.progress_horizontal));
pg.setProgress(40);
4

4 に答える 4

1

16進カラーコードの代わりにRGB値を使用してみてください。ColorPicまたは他の同様のツールを使用して、16進カラーコードのRGB値を簡単に見つけることができます。

于 2013-01-18T06:26:08.913 に答える
1

このコードを使用してください

            String source = "<b><font color=#ff0000> Loading. Please wait..."
                    + "</font></b>";
            pd = ProgressDialog.show(Main.this, "",

            Html.fromHtml(source), true);
            pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
于 2013-01-18T06:23:09.877 に答える
0

このようにしてみてください。

  ProgressBar pg = (ProgressBar)row.findViewById(R.id.progress);
    final float[] roundedCorners = new float[] { 5, 5, 5, 5, 5, 5, 5, 5 };
    pgDrawable = new ShapeDrawable(new RoundRectShape(roundedCorners, null,null));
    String MyColor = "#FF00FF";
    pgDrawable.getPaint().setColor(Color.parseColor(MyColor));
    ClipDrawable progress = new ClipDrawable(pgDrawable, Gravity.LEFT, ClipDrawable.HORIZONTAL);
    pg.setProgressDrawable(progress);   
    pg.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.progress_horizontal));
    pg.setProgress(45);

これをインポートする

importandroid.graphics.drawable。*;

プログレスバー

于 2013-01-18T06:38:44.327 に答える
0

このようにしてみてください」

Drawable progressDrawablePause = MainActivity.this.getResources().getDrawable(R.drawable.download_progressbar_pause_bg);
            progressDrawablePause.setBounds(bar.getProgressDrawable().getBounds());
            bar.setProgressDrawable(progressDrawablePause);
            bar.setProgress(60);

最初:描画可能な境界を設定します2番目:progressdrawableを設定します3番目:setprogress

于 2013-03-17T08:36:55.450 に答える