开发者

a "loader" next to a button using a style

I'm still new to Java in general, so I decided some SOF input would be helpful on this question-

I have a Button that, when clicked, I want a ProgressBar to show next to it. I would like to do this wi开发者_StackOverflowth a style, preferably to just send the needed style via setBackgroundDrawable.

I've done this in CSS a number of times where I just add a class which contains the background element I need and pushes the text out a handful of pixels. I'm hoping I can do something similar because I have a lot of Button objects to perform this on.

I've used JS to create an example of what I want to accomplish. I'm hoping this will iterate my point better: http://jsfiddle.net/puPdK/3/

Please feel to let me know if there is a better way. I'm all ears! Thanks.


Animated GIF does not work with android.

so if you want to animate something in your case frameanimation can be used.

or you can use ProgressBar.setIndeterminate which will show a spinning circle. and you can use view's visibility.

we don't have the javascript part of HTML/CSS/JavaScript, which is missing in android's xml/stye/? as you have asked.

we have to see the java code more of the server-side or back-end code.


I decided the best way to do this (to my knowledge) was to wrap my button in a horizontal LinearLayout. When the button is clicked, I add a new ProgressBar as child zero to my the layout (eg container.addView(myProgressBar, 0). When the loading is done, I then remove the first child from my layout container.removeViewAt(0). Viola.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜