android progressbar的白色背景怎么去掉

asdfgcjw 2014-08-22 09:58:33
加精
我在下载web端的资源的时候,要跳出一个progressbar,但它的自定义图标里有一个白色背景,这个背景怎么去掉,
求教
...全文
3865 38 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
38 条回复
切换为时间正序
请发表友善的回复…
发表回复
read_act 2014-12-05
  • 打赏
  • 举报
回复
引用 34 楼 asdfgcjw 的回复:
楼上的各种方法我都试过,其实很简单,只要在代码里设置透明度就一切ok了,不知道什么原因,在xml设置就是没有效果
代码里没有那个方法
read_act 2014-12-05
  • 打赏
  • 举报
回复
引用 34 楼 asdfgcjw 的回复:
楼上的各种方法我都试过,其实很简单,只要在代码里设置透明度就一切ok了,不知道什么原因,在xml设置就是没有效果
代码里没有那个方法
gdeoicdt 2014-08-24
  • 打赏
  • 举报
回复
有图片吗,不明白你是哪种样式的
asdfgcjw 2014-08-23
  • 打赏
  • 举报
回复
楼上的各种方法我都试过,其实很简单,只要在代码里设置透明度就一切ok了,不知道什么原因,在xml设置就是没有效果
baidu_19981085 2014-08-23
  • 打赏
  • 举报
回复
不知道咋样。。。。
admainer 2014-08-22
  • 打赏
  • 举报
回复
设置下透明度属性啊 android:alpha=""
一休969 2014-08-22
  • 打赏
  • 举报
回复
fireyou 2014-08-22
  • 打赏
  • 举报
回复
可以自定义这个。
sd1607 2014-08-22
  • 打赏
  • 举报
回复
要好好学习一下,都是高手。
gaoshizhou 2014-08-22
  • 打赏
  • 举报
回复
厉害啊,小弟佩服
zhhuaw 2014-08-22
  • 打赏
  • 举报
回复
引用 19 楼 asdfgcjw 的回复:
[quote=引用 16 楼 zhhuaw 的回复:] [quote=引用 15 楼 zhhuaw 的回复:] android:background="@android:color/transparent"
忘了说这是透明[/quote] 泪崩,设置了好像没用,android:color/transparent这个是根据背景还是什么来的?[/quote] 是google给开发者提供好的颜色值,不是根据背景,
asdfgcjw 2014-08-22
  • 打赏
  • 举报
回复
引用 18 楼 lionfresh 的回复:
[quote=引用 13 楼 asdfgcjw 的回复:] [quote=引用 9 楼 lionfresh 的回复:] [quote=引用 8 楼 asdfgcjw 的回复:] [quote=引用 6 楼 zhhuaw 的回复:] 刚试了下 不用放在layout中也可以 ,把progressbar的背景色你可以设置,不要背景则透明,改变背景色设置背景色就可以了
怎么设置成透明,求指教[/quote] android:background = "#00000000"[/quote] 那是白色啊,不是透明的[/quote] 请注意0的个数[/quote] 可能是我的底色不行,我是activity上面跳dialog,在dialog上面再跳dialog,可能这里有问题、、、
asdfgcjw 2014-08-22
  • 打赏
  • 举报
回复
引用 16 楼 zhhuaw 的回复:
[quote=引用 15 楼 zhhuaw 的回复:] android:background="@android:color/transparent"
忘了说这是透明[/quote] 泪崩,设置了好像没用,android:color/transparent这个是根据背景还是什么来的?
lionfresh 2014-08-22
  • 打赏
  • 举报
回复
引用 13 楼 asdfgcjw 的回复:
[quote=引用 9 楼 lionfresh 的回复:] [quote=引用 8 楼 asdfgcjw 的回复:] [quote=引用 6 楼 zhhuaw 的回复:] 刚试了下 不用放在layout中也可以 ,把progressbar的背景色你可以设置,不要背景则透明,改变背景色设置背景色就可以了
怎么设置成透明,求指教[/quote] android:background = "#00000000"[/quote] 那是白色啊,不是透明的[/quote] 请注意0的个数
asdfgcjw 2014-08-22
  • 打赏
  • 举报
回复
引用 16 楼 zhhuaw 的回复:
[quote=引用 15 楼 zhhuaw 的回复:]
android:background="@android:color/transparent"

忘了说这是透明[/quote]


zhhuaw 2014-08-22
  • 打赏
  • 举报
回复
引用 15 楼 zhhuaw 的回复:
android:background="@android:color/transparent"
忘了说这是透明
zhhuaw 2014-08-22
  • 打赏
  • 举报
回复
android:background="@android:color/transparent"
zhhuaw 2014-08-22
  • 打赏
  • 举报
回复
web加载数据的时候你可以试试用ProgressDialog dialog = new ProgressDialog(this); dialog.setMessage("正在加载数据...");//设置提示信息 dialog.setCancelable(true);//设置是否可以取消 在数据开始加载时 dialog.show();,数据加载完毕dialog.dismiss();
asdfgcjw 2014-08-22
  • 打赏
  • 举报
回复
引用 9 楼 lionfresh 的回复:
[quote=引用 8 楼 asdfgcjw 的回复:] [quote=引用 6 楼 zhhuaw 的回复:] 刚试了下 不用放在layout中也可以 ,把progressbar的背景色你可以设置,不要背景则透明,改变背景色设置背景色就可以了
怎么设置成透明,求指教[/quote] android:background = "#00000000"[/quote] 那是白色啊,不是透明的
asdfgcjw 2014-08-22
  • 打赏
  • 举报
回复
引用 11 楼 zhhuaw 的回复:
[quote=引用 10 楼 asdfgcjw 的回复:] [quote=引用 6 楼 zhhuaw 的回复:] 刚试了下 不用放在layout中也可以 ,把progressbar的背景色你可以设置,不要背景则透明,改变背景色设置背景色就可以了
如果不是dialog的话,没有设背景的话,就是白色了,但是我要跳出个dialog来,这样的话要颜色透明的,不知道怎么弄了 [/quote] 自定义dialog你会吗,你可以自定义dialog,那样想要什么样的效果都可以做出来[/quote] 是用progressdialog,还是progressbar来自定义?
加载更多回复(14)
总共分为三层:一层为圆形边线,一层为进度边线,一层用来显示标识进度节点。 public class CircleProgressBar extends View { private int maxProgress = 100; private int progress = 15; private int progressStrokeWidth = 2; private int marxArcStorkeWidth = 16; // 画圆所在的距形区域 RectF oval; Paint paint; public CircleProgressBar(Context context, AttributeSet attrs) { super(context, attrs); // TODO Auto-generated constructor stub oval = new RectF(); paint = new Paint(); } @Override protected void onDraw(Canvas canvas) { // TODO 自动生成的方法存根 super.onDraw(canvas); int width = this.getWidth(); int height = this.getHeight(); width = (width > height) ? height : width; height = (width > height) ? height : width; paint.setAntiAlias(true); // 设置画笔为抗锯齿 paint.setColor(Color.WHITE); // 设置画笔颜色 canvas.drawColor(Color.TRANSPARENT); // 白色背景 paint.setStrokeWidth(progressStrokeWidth); // 线宽 paint.setStyle(Style.STROKE); oval.left = marxArcStorkeWidth / 2; // 左上角x oval.top = marxArcStorkeWidth / 2; // 左上角y oval.right = width - marxArcStorkeWidth / 2; // 左下角x oval.bottom = height - marxArcStorkeWidth / 2; // 右下角y canvas.drawArc(oval, -90, 360, false, paint); // 绘制白色圆圈,即进度条背景 paint.setColor(Color.rgb(0x57, 0x87, 0xb6)); paint.setStrokeWidth(marxArcStorkeWidth); canvas.drawArc(oval, -90, ((float) progress / maxProgress) * 360, false, paint); // 绘制进度圆弧,这里是蓝色 paint.setStrokeWidth(1); String text = progress + "%"; int textHeight = height / 4; paint.setTextSize(textHeight); int textWidth = (int) paint.measureText(text, 0, text.length()); paint.setStyle(Style.FILL); canvas.drawText(text, width / 2 - textWidth / 2, height / 2 + textHeight / 2, paint); } public int getMaxProgress() { return maxProgress; } public void setMaxProgress(int maxProgress) { this.maxProgress = maxProgress; } /** * 设置进度 * * @param progress * 进度百分比 * @param view * 标识进度的节点视图 */ public void setProgress(int progress, View view) { this.progress = progress; view.setAnimation(pointRotationAnima(0, (int) (((float) 360 / maxProgress) * progress))); this.invalidate(); } /** * 非UI线程调用 */ public void setProgressNotInUiThread(int progress, View view) { this.progress = progress; view.setAnimation(pointRotationAnima(0, (int) (((float) 360 / maxProgress) * progress))); this.postInvalidate(); } /** * 进度标注点的动画 * * @param fromDegrees * @param toDegrees * @return */ private Animation pointRotationAnima(float fromDegrees, float toDegrees) { int initDegress = 306;// 进度点起始位置(图片偏移约54度) RotateAnimation animation = new RotateAnimation(fromDegrees, initDegress + toDegrees, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setDuration(1);// 设置动画执行时间 animation.setRepeatCount(1);// 设置重复执行次数 animation.setFillAfter(true);// 设置动画结束后是否停留在结束位置 return animation; } }

80,471

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧