Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/224.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 无法确定在不同布局之间放置进度条的位置_Android_Drawerlayout_Androiddesignsupport_Android Coordinatorlayout - Fatal编程技术网

Android 无法确定在不同布局之间放置进度条的位置

Android 无法确定在不同布局之间放置进度条的位置,android,drawerlayout,androiddesignsupport,android-coordinatorlayout,Android,Drawerlayout,Androiddesignsupport,Android Coordinatorlayout,我在一个活动中使用了FrameLayout、DrawerLayout、RelativeLayout和CoordinatorLayout。现在我想添加这个水平进度条: 但是,我不知道将其放在代码中的何处,以便它显示在“回收器”视图的上方和工具栏的下方??我的活动xml文件如下所示: <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/re

我在一个活动中使用了FrameLayout、DrawerLayout、RelativeLayout和CoordinatorLayout。现在我想添加这个水平进度条:

但是,我不知道将其放在代码中的何处,以便它显示在“回收器”视图的上方和工具栏的下方??我的活动xml文件如下所示:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:fab="http://schemas.android.com/tools"
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <android.support.v4.widget.DrawerLayout
        android:id="@+id/DrawerLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:elevation="7dp"
        android:fitsSystemWindows="true">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <ProgressBar
                android:id="@+id/progressBar"
                style="?android:attr/progressBarStyle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:visibility="visible" />
        </RelativeLayout>

        <android.support.design.widget.CoordinatorLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <include
                android:id="@+id/app_bar_layout"
                layout="@layout/pmp_toolbar" />

            <android.support.v7.widget.RecyclerView
                android:id="@+id/pmp_list"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scrollbars="vertical"
                app:layout_behavior="@string/appbar_scrolling_view_behavior" />
        </android.support.design.widget.CoordinatorLayout>


        <android.support.design.widget.NavigationView
            android:id="@+id/nav_view"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            android:fitsSystemWindows="true"
            app:menu="@menu/menu_navigation_drawer" />

    </android.support.v4.widget.DrawerLayout>


    <com.getbase.floatingactionbutton.FloatingActionsMenu
        android:id="@+id/rignt_bottom_floating_action_menu"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:layout_gravity="bottom|right"
        android:layout_margin="@dimen/fab_margin"
        android:elevation="12dp"
        fab:fab_addButtonColorNormal="@color/pink"
        fab:fab_addButtonColorPressed="@color/pink_pressed"
        fab:fab_addButtonPlusIconColor="@color/white"
        fab:fab_icon="@drawable/ic_filter"
        fab:fab_labelStyle="@style/menu_labels_style">

        <com.getbase.floatingactionbutton.FloatingActionButton
            android:id="@+id/action_a"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            fab:fab_colorNormal="@color/FF4081"
            fab:fab_colorPressed="@color/green_pressed"
            fab:fab_icon="@drawable/ic_filter"
            fab:fab_title="By Price" />


        <com.getbase.floatingactionbutton.FloatingActionButton
            android:id="@+id/action_c"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            fab:fab_colorNormal="@color/FF4081"
            fab:fab_colorPressed="@color/green_pressed"
            fab:fab_icon="@drawable/ic_filter"
            fab:fab_title="By Rating" />
    </com.getbase.floatingactionbutton.FloatingActionsMenu>

</FrameLayout>

任何答案都将不胜感激,因为我已经在这方面浪费了大量时间。

你可以放在最上面right@Rustam你能指出确切的位置吗?我已经更新了这个问题。我需要它上面的回收视图在你第一次@Tasos之后,一个答案将非常有用。顺便说一句,我想在屏幕上的任何地方都可以看到它。例如,现在我在工具栏下方和recylcer视图上方找到它。提前谢谢。这很简单。在framelayout中添加android:layout_marginTop=whateverdp margin left,margin right。顺便说一下,您还可以使用match_parent来表示宽度、高度。我不回答这个问题,因为我用这种方法把图标放在我想放在屏幕上其他版面顶部的地方,但从来没有用进度条尝试过。应该是一样的。如果有效,让我知道,我会回答的
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:fab="http://schemas.android.com/tools"
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <android.support.v4.widget.DrawerLayout
        android:id="@+id/DrawerLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:elevation="7dp"
        android:fitsSystemWindows="true">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <ProgressBar
                android:id="@+id/progressBar"
                style="?android:attr/progressBarStyle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:visibility="visible" />
        </RelativeLayout>

        <android.support.design.widget.CoordinatorLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <include
                android:id="@+id/app_bar_layout"
                layout="@layout/pmp_toolbar" />

            <android.support.v7.widget.RecyclerView
                android:id="@+id/pmp_list"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scrollbars="vertical"
                app:layout_behavior="@string/appbar_scrolling_view_behavior" />
        </android.support.design.widget.CoordinatorLayout>


        <android.support.design.widget.NavigationView
            android:id="@+id/nav_view"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            android:fitsSystemWindows="true"
            app:menu="@menu/menu_navigation_drawer" />

    </android.support.v4.widget.DrawerLayout>


    <com.getbase.floatingactionbutton.FloatingActionsMenu
        android:id="@+id/rignt_bottom_floating_action_menu"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:layout_gravity="bottom|right"
        android:layout_margin="@dimen/fab_margin"
        android:elevation="12dp"
        fab:fab_addButtonColorNormal="@color/pink"
        fab:fab_addButtonColorPressed="@color/pink_pressed"
        fab:fab_addButtonPlusIconColor="@color/white"
        fab:fab_icon="@drawable/ic_filter"
        fab:fab_labelStyle="@style/menu_labels_style">

        <com.getbase.floatingactionbutton.FloatingActionButton
            android:id="@+id/action_a"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            fab:fab_colorNormal="@color/FF4081"
            fab:fab_colorPressed="@color/green_pressed"
            fab:fab_icon="@drawable/ic_filter"
            fab:fab_title="By Price" />


        <com.getbase.floatingactionbutton.FloatingActionButton
            android:id="@+id/action_c"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            fab:fab_colorNormal="@color/FF4081"
            fab:fab_colorPressed="@color/green_pressed"
            fab:fab_icon="@drawable/ic_filter"
            fab:fab_title="By Rating" />
    </com.getbase.floatingactionbutton.FloatingActionsMenu>

</FrameLayout>