samedi 3 janvier 2015

Add progress bar to TabHost


Vote count:

0




I have a TabHost activity and it has three tabs each which loads data from the web and while this data is being loaded I want to display a progress bar in the middle of the screen. I know how do this is this was just a plain old Rel Layout something kinda like this



RelativeLayout layout = new RelativeLayout(this);
progressBar = new ProgressBar(DiningItemsActivity.this,null,android.R.attr.progressBarStyleLarge);
progressBar.setIndeterminate(true);
progressBar.setVisibility(View.VISIBLE);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(100,100);
params.addRule(RelativeLayout.CENTER_IN_PARENT);
layout.addView(progressBar,params);

setContentView(layout);


But I am having trouble getting it to work with the TabHost I tried doing it in xml but I just got the progress bar in the tab host not in the middle of the screen. Here is what I want it to look like


enter image description here


So how could I do this with the TabHost, either programaticlly or in xml.


Thanks for the help in advance :)



asked 1 min ago







Add progress bar to TabHost

Aucun commentaire:

Enregistrer un commentaire