Android 浮动动作按钮锚定,包含布局
您知道是否可以使用布局中包含的id视图作为晶圆厂的锚定?例如:Android 浮动动作按钮锚定,包含布局,android,material-design,Android,Material Design,您知道是否可以使用布局中包含的id视图作为晶圆厂的锚定?例如: <include layout="@layout/content_main" /> <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" app
<include layout="@layout/content_main" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_anchor="@id/map"
app:layout_anchorGravity="bottom|right|end"
android:layout_margin="@dimen/fab_margin"
android:src="@android:drawable/ic_menu_add" />
“@id/map”位于包含的布局内容内。
使用此代码,我当前得到以下错误:
错误:(30,28)未找到与给定名称匹配的资源(位于
“layout_anchor”的值为“@id/map”)
有关信息,我正在使用include来减少我的主布局大小
似乎晶圆厂主播看不到“@id/map”。但我可能做错了什么。我猜你缺少了标签Id
android:Id=“@+Id/map”
打开您的@layout/content\u main
浮动操作按钮用于一种特殊类型的升级操作
行动。它们通过漂浮在UI上方的圆圈图标来区分
并具有与变形、发射和发射相关的特殊运动行为
转移锚点
我认为app:layout_anchor=“@+id/map”中缺少加号“+”,在某些情况下,这是因为AppBarLayout是在xml文件中将其称为锚点的视图之后声明的 我为迟来的答复道歉。你说得对,阿米娅,这是包含文件中的一个输入错误。谢谢你的帮助:)如果这能帮上忙,我又遇到了同样的问题。因为我使用
app:layout\u-anchor=“@id/textView”
而不是app:layout\u-anchor=“@+id/textView”
。我想我们不能在包含id的情况下使用“@id/…”
。
Error:(30, 28) No resource found that matches the given name (at 'layout_anchor' with value '@id/map').