gmail like Progress bar functionality

Refresh

April 2019

Views

1.1k time

1

enter image description hereI am creating a gmail like progress bar functionality. There seems to be some space between the actionbar and the progress bar.

Following is the code

<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">

<!-- As the main content view, the view below consumes the entire
     space available using match_parent in both dimensions. -->
<FrameLayout
    android:id="@+id/content_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

    <ProgressBar
    android:id="@+id/progressBar1"
    style="?android:attr/progressBarStyleHorizontal"
    android:indeterminateOnly="true"
    android:layout_width="wrap_content"
    android:layout_height="?android:attr/actionBarSize" />

<ListView
    android:id="@+id/left_drawer"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:choiceMode="singleChoice"
    android:divider="@android:color/transparent"
    android:dividerHeight="0dp"
    android:background="#111"/>
</android.support.v4.widget.DrawerLayout>

2 answers

0

To add a navigation drawer, declare your user interface with a DrawerLayout object as the root view of your layout. Inside the DrawerLayout, add one view that contains the main content for the screen (your primary layout when the drawer is hidden) and another view that contains the contents of the navigation drawer. for more Creating a Navigation Drawer.

1

DrawerLayout should contain only two children: FrameLayout for your content and fragment for drawer. Thus ProgressBar should be located inside dynamically created content.