[英]How to create and draw a progress bar that is created in a class that extends from View
I want to know if it is possible to create a progress bar that is created in a class that extends from the class View?我想知道是否可以创建在从 class 视图扩展的 class 中创建的进度条?
My intention is to add a progress bar in my animation, using the "On a View" structure for creating animations in android:我的意图是在我的 animation 中添加一个进度条,使用“On a View”结构在 android 中创建动画:
http://developer.android.com/guide/topics/graphics/index.html http://developer.android.com/guide/topics/graphics/index.html
I tried with the fallowing way, in the view class, but it didn't appear.我尝试了休闲方式,在视图 class 中,但没有出现。
public class CustomDrawableView extends View {
private ProgressBar mProgress;
public CustomDrawableView(Context context) {
super(context);
mProgress = new ProgressBar(context, null, android.R.attr.progressBarStyleSmall);
}
protected void onDraw(Canvas canvas) {
mProgress.draw(canvas);
}
}
Any suggestion?有什么建议吗?
Greetings问候
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.