Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/198.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
Java Android-Snackbar覆盖我的视图_Java_Android - Fatal编程技术网

Java Android-Snackbar覆盖我的视图

Java Android-Snackbar覆盖我的视图,java,android,Java,Android,为什么Snackbar会覆盖我的视图 这是我的xml <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/fullview" android:layout_width="match_pare

为什么Snackbar会覆盖我的视图

这是我的xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/fullview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/dark_gray"
    >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

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

            <TextView
                android:id="@+id/reload"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:gravity="center"
                android:layout_centerInParent="true"
                android:text="@string/reload"
                android:visibility="visible" />

            <ProgressBar
                android:id="@+id/progressbar"
                style="?android:attr/progressBarStyleLarge"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:gravity="center"
                android:visibility="gone" />

            <android.support.v7.widget.RecyclerView
                android:id="@+id/complist"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                android:layout_gravity="center"

                android:fadeScrollbars="false" />
        </RelativeLayout>


        <LinearLayout
            android:id="@+id/buttons"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:layout_margin="5dp"
            android:orientation="horizontal">

            <Button
                android:id="@+id/send"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_margin="5dp"
                android:layout_weight="1"
                android:background="@color/blue"
                android:text="@string/send"
                android:textColor="@android:color/white" />

            <Button
                android:id="@+id/cancel"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_margin="5dp"
                android:layout_weight="1"
                android:background="@color/green"
                android:text="@string/cancel"
                android:textColor="@android:color/white" />
        </LinearLayout>
    </LinearLayout>
</android.support.design.widget.CoordinatorLayout>
这是屏幕截图

我想念的是什么?

这里说:

小吃条出现在屏幕上所有其他元素的上方,只有一个可以 一次显示一次


因此,Snackbar将覆盖您的视图,就像敬酒一样。

您可以发布它的外观吗image@johnrao07:从编辑历史记录来看,您似乎从问题中删除了图像。可以,我重新添加它。不应该阻止我的按钮,请查看,上面说不要阻止浮动动作button@MinaFawzy是的,它不会阻止浮动按钮,因为当Snackbar显示时,它会将其向上移动一点。我的意思是它是一样的,它会阻止我的按钮,它不应该这样做。它不一样。您的按钮属于
android.widget.button
类,但浮动操作按钮属于
android.support.design.widget.FloatingActionButton
FloatingActionButton
扩展了
ImageButton
,并向其添加了浮动功能。
 private CoordinatorLayout _CoordinatorLayout;

@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View v = inflater.inflate(R.layout.compition, null);

        _CoordinatorLayout = (CoordinatorLayout) v.findViewById(R.id.fullview);

}

Snackbar.make(_CoordinatorLayout , message , Snackbar.LENGTH_LONG).show();