Skip to content Skip to sidebar Skip to footer

Show Progress Bar Center Of Screen

I using a progress bar inside my layout. When I start the app the progress bar is always aligned to top left corner of screen. Below is my xml layout file. how can I align it on c

Solution 1:

Remove Progress bar from ScrollView and place it as the first child of parent layout and use android:layout_centerInParent="true"

<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"android:id="@+id/relativeLayout1"android:orientation="vertical"android:background="#F1F1F1"><ProgressBarandroid:id="@+id/progressBar"android:layout_width="wrap_content"android:layout_height="wrap_content"android:indeterminateDrawable="@drawable/my_progress_indeterminate"android:layout_centerInParent="true" ></ProgressBar><ScrollViewandroid:layout_width="fill_parent"android:layout_height="fill_parent" ><LinearLayoutandroid:layout_width="fill_parent"android:layout_height="fill_parent"android:orientation="vertical"android:id="@+id/scrolllinear">

Solution 2:

To center it try in your progress bar area.

android:gravity="center"

Post a Comment for "Show Progress Bar Center Of Screen"