像进度条功能一样的gmail

时间:2014-07-23 13:22:05

标签: android navigation-drawer android-progressbar drawerlayout

enter image description here我正在创建一个像进度条功能一样的gmail。操作栏和进度条之间似乎有一些空格。

以下是代码

<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 个答案:

答案 0 :(得分:1)

DrawerLayout应该只包含两个子项:内容为FrameLayout,抽屉为fragment。因此ProgressBar应位于动态创建的内容中。

答案 1 :(得分:0)

要添加navigation drawer,请使用DrawerLayout对象声明您的用户界面作为布局的根视图。在DrawerLayout内,添加一个包含屏幕主要内容的视图(隐藏抽屉时的主要布局)和另一个包含导航抽屉内容的视图。更多Creating a Navigation Drawer