如何以编程方式创建一个进度条?创建一个、进度条、方式

由网友(栀晚鸢乱)分享简介:我的应用程序需要以编程方式创建一个小的进度。进度条没有方法来设置样式(我想一个小进度条)。构造可以采取的AttributeSet,但它是一个接口和要求我实现了一组功能。有没有一种方法设置进度条的小风格? (我不能使用XML创建进度条)My application need to create a small...

我的应用程序需要以编程方式创建一个小的进度。 进度条没有方法来设置样式(我想一个小 进度条)。构造可以采取的AttributeSet,但它是一个 接口和要求我实现了一组功能。有没有一种方法 设置进度条的小风格? (我不能使用XML创建 进度条)

My application need to create a small progressBar programmatically. ProgressBar doesn't have method to set the style (I want a small progressBar). The constructor can take a AttributeSet, however it is a interface and require me implements a set of functions. Is there a way to set the progressBar small style? ( I can't use xml to create progressBar)

推荐答案

在大多数情况下,如果你提供了一个的AttributeSet 手动你必须使用Android的之一。幸运的是,他们已经暴露,描述了一个小的进度条的属性集。使用此code:

Most of the time if you provide an AttributeSet manually you have to use one of Android's. Luckily, they've exposed the attribute set that describes a small progress bar. Use this code:

progressBar = new ProgressBar(activity, null, android.R.attr.progressBarStyleSmall);
阅读全文

相关推荐

最新文章