错误编译版本布局
当我按下构建版本我得到的问题,但是当我按调试是没有问题的:错误编译版本布局
Error:(52) Error: The id "recycler_viewContainer" is not defined anywhere. [UnknownId]
Error:(52) Error: @id/recycler_view is not a sibling in the same RelativeLayout [NotSibling]
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:fab="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/main_layout"
tools:context="ru.ifsoft.mymarketplace.StreamFragment">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/container_body" >
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/container_items"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_width="match_parent"
android:background="@color/white">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:scrollbars="none" />
</android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/message"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fabButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:layout_marginRight="24dp"
android:src="@drawable/ic_action_new"
app:fabSize="normal"
app:layout_anchor="@id/recycler_view"
android:elevation="2dp"
android:layout_marginEnd="41dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
fab:fab_colorNormal="@color/colorFloatActionButton"
fab:fab_colorPressed="@color/colorFloatActionButton"
fab:fab_colorRipple="@color/colorRipple" />
</RelativeLayout>
这是您的xml兄弟姐妹结构和错误。
的错误是,profileListView
并不是直接的同胞。也就是说,它是直接兄弟里面,LinearLayout中profileContainer
因此,我们将给予直接的兄弟ID来解决这个问题。
同样,给一个id的recycler_view
父,并用它来SOVE直接兄弟问题的recycler_view
。
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fabButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:layout_marginRight="24dp"
android:src="@drawable/ic_action_new"
app:fabSize="normal"
app:layout_anchor="@+id/container_body" // Used id of the LinerLayout, which is the direct sibling of the root layout
android:elevation="2dp"
android:layout_marginEnd="41dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
fab:fab_colorNormal="@color/colorFloatActionButton"
fab:fab_colorPressed="@color/colorFloatActionButton"
fab:fab_colorRipple="@color/colorRipple" />
现在编辑你请帮我 –
RecylerView是另一种布局。对?使用'app:layout_anchor =“@ + id/container_body”'为那FloatingActionButton – Nizam
我不明白同样,给一个id给recycler_view的父项,并用它来解决recycler_view的直接兄弟问题。 –
变化FloatingActionButton
app:layout_anchor="@id/profileListView"
到
app:layout_anchor="@+id/profileContainer"
应用:layout_anchor = “@ ID/recycler_view” 到
应用:layout_anchor = “@ + ID/container_body”
希望这会帮助你。
它的工作让我像他们一样的问题你能帮我吗? 错误:(52)错误:@ id/recycler_view不是同一个RelativeLayout中的兄弟[NotSibling] –
检查或发布您在其中使用recycle_view的xml文件。 –
现在编辑你请帮我 –
change @ + id/profileListView而不是@id/profileListView –
为什么不用'profileContainer'来代替? 'app:layout_anchor =“@ + id/profileContainer”' – Nizam
我不明白我应该怎么做@Nizam –