Kumar
Kumar

Reputation: 127

progressbar is not displaying in title bar

I am using the following code, but my progress bar is not displaying in title bar instead displaying in my activiy top right corner

    <ProgressBar 
android:id="@+id/progress_bar" style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"

android:layout_marginRight="5dp" />

in code

//requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.welcome_layout);

Can any one plz help me out in this ..

Upvotes: 0

Views: 278

Answers (1)

Michael
Michael

Reputation: 54705

You should either create your own ProgressBar or use one in the title bar. So, in your case, you don't need this ProgressBar definition in the layout file. Just do the following:

requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); 
setProgressBarIndeterminateVisibility(true);

Upvotes: 2

Related Questions