更新新视图中实现的进度条
我想更新我的应用程序中的进度栏。
我通过使用充气器创建了一个新视图,在该新创建的视图中我想显示水平进度条更新。
我怎样才能特别做到这一点?
我还知道,当我们通过 Inflater 创建一个新视图时,我们需要通过 addContentView() 将其添加到当前活动类中,尽管到目前为止我已经尝试了很多,但我不知道如何执行这些操作。
有人可以帮我吗?
I want to Update the Progress bar in my application.
I have created a new view by making use of inflater and in that newly created view I want to show the Horizontal Progress Bar Updating.
How can I do that particularly?
Also I got to know that when We create a new view by Inflater, we need to add it to the Current Activity Class by addContentView(), I don't know how to do these though I have tried a lot till now.
Can anybody help me here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因此,由于您不提供代码,所以让我搜索我的水晶球...等等...好吧,就在那里。您有这样的事情:
为了访问您的
ProgressBar
,您必须使用findViewById
方法:为了将包含进度条的视图添加到您当前的活动中,您必须拥有对之前设置的容器的引用。所以,我猜你之前做过:
setContentView(R.layout.something);
,然后你就有了一个名为something.xml
; 的布局。该布局包含一个 ViewGroup(LinearLayout
、RelativeLayout
等;我的水晶球看不清楚)。然后,您需要为该容器设置一个 ID,创建一个引用,并将新创建的视图添加到其中:So, as you don't provide code, let me search my crystal ball... wait... OK, there it is. You have something like this:
In order to access your
ProgressBar
, you have to use thefindViewById
method:In order to add the view that contains the progress bar to you current activity, you have to have a reference to the container that you previously set. So, I guess you previously did:
setContentView(R.layout.something);
, then you have a layout calledsomething.xml
; that layout contains aViewGroup
(LinearLayout
,RelativeLayout
, etc.; my crystal ball can't see that clearly). Then, you need to set an ID to that container, create a reference, and add your newly created view to it: