Java 循环依赖项不能存在于RelativeLayout Android XML中

Java 循环依赖项不能存在于RelativeLayout Android XML中,java,android,xml,android-layout,Java,Android,Xml,Android Layout,我试图在ExtendedViewPager的底部设置Admob横幅,但并没有成功。我在呈现过程中遇到一个异常错误:RelativeLayout中不能存在循环依赖项 我希望我的智能横幅广告位于XML的底部 我的XML如下所示 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools

我试图在ExtendedViewPager的底部设置Admob横幅,但并没有成功。我在呈现过程中遇到一个异常错误:RelativeLayout中不能存在循环依赖项 我希望我的智能横幅广告位于XML的底部

我的XML如下所示

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns: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"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:fab="http://schemas.android.com/apk/res-auto"
    tools:context="com.karopass.karoshare.ImageDetails">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar_imageDetails"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/colorPrimary"
        android:theme="@style/AppTheme.AppBarOverlay"
        app:popupTheme="@style/AppTheme.PopupOverlay">
    </android.support.v7.widget.Toolbar>

    <com.example.utils.ExtendedViewPager
        android:id="@+id/view_pager_extended"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/toolbar_imageDetails"
        android:background="@color/image_back"/>

    <com.github.clans.fab.FloatingActionMenu
        android:id="@+id/floating_menu"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:menu_colorNormal="@color/fab_menu"
        app:menu_labels_colorNormal="@color/btn_fab_labels_color"
        android:layout_marginRight="10dp"
        android:layout_marginBottom="10dp"
        android:layout_above="@+id/ll_adLayout_image"
        android:layout_alignParentRight="true" >

        <com.github.clans.fab.FloatingActionButton
            android:id="@+id/button_likeDislike"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:fab_colorNormal="@color/fab_button"
            android:src="@mipmap/fav"
            fab:fab_size="mini"
            fab:fab_label="Like (10)" />

        <com.github.clans.fab.FloatingActionButton
            android:id="@+id/button_share_image"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:fab_colorNormal="@color/fab_button"
            android:src="@mipmap/share_white"
            fab:fab_size="mini"
            fab:fab_label="Share" />

        <com.github.clans.fab.FloatingActionButton
            android:id="@+id/button_copy_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:fab_colorNormal="@color/fab_button"
            android:src="@mipmap/copy"
            fab:fab_size="mini"
            fab:fab_label="" />


    </com.github.clans.fab.FloatingActionMenu>

    <LinearLayout
        android:layout_alignParentBottom="true"
        android:id="@+id/ll_adLayout_image"
        android:layout_below="@+id/floating_menu"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:orientation="vertical">

    </LinearLayout>

</RelativeLayout>

是否有人可以检查并帮助我解决此问题?

此问题是由于布局参数中存在循环引用而导致的


您正在给LinearLayout属性android:layout_Lower=@+id/floating_菜单,在FloatingAction按钮中,您正在给android:layout_Lower=@+id/ll_adLayout_图像,说明发生异常的原因。

这里您定义了LinearLayout-ll_adLayout_图像,位于floating_菜单下方,然后还定义了您的floating_菜单上方ll_adLayout_图像线性布局这是循环相关性, 对于解决问题,您需要删除任何一个依赖项

已解决问题的代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns: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"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:fab="http://schemas.android.com/apk/res-auto"
    tools:context="com.karopass.karoshare.ImageDetails">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar_imageDetails"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/colorPrimary"
        android:theme="@style/AppTheme.AppBarOverlay"
        app:popupTheme="@style/AppTheme.PopupOverlay">
    </android.support.v7.widget.Toolbar>

    <com.example.utils.ExtendedViewPager
        android:id="@+id/view_pager_extended"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/toolbar_imageDetails"
        android:background="@color/image_back"/>

    <com.github.clans.fab.FloatingActionMenu
        android:id="@+id/floating_menu"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:menu_colorNormal="@color/fab_menu"
        app:menu_labels_colorNormal="@color/btn_fab_labels_color"
        android:layout_marginRight="10dp"
        android:layout_marginBottom="10dp"
        android:layout_above="@+id/ll_adLayout_image"
        android:layout_alignParentRight="true" >

        <com.github.clans.fab.FloatingActionButton
            android:id="@+id/button_likeDislike"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:fab_colorNormal="@color/fab_button"
            android:src="@mipmap/fav"
            fab:fab_size="mini"
            fab:fab_label="Like (10)" />

        <com.github.clans.fab.FloatingActionButton
            android:id="@+id/button_share_image"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:fab_colorNormal="@color/fab_button"
            android:src="@mipmap/share_white"
            fab:fab_size="mini"
            fab:fab_label="Share" />

        <com.github.clans.fab.FloatingActionButton
            android:id="@+id/button_copy_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:fab_colorNormal="@color/fab_button"
            android:src="@mipmap/copy"
            fab:fab_size="mini"
            fab:fab_label="" />


    </com.github.clans.fab.FloatingActionMenu>

    <LinearLayout
        android:layout_alignParentBottom="true"
        android:id="@+id/ll_adLayout_image"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:orientation="vertical">

    </LinearLayout>

</RelativeLayout>

谢谢兄弟…工作很好…你救了我一天…我会在5分钟内接受答案。谢谢lot@AvantikaSharma很高兴知道这一点。