您是否知道是否可以将布局中包含的id视图用作FAB的锚点?例如 :
<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”位于包含的布局content_main中。
有了这段代码,我目前得到以下错误:
错误:(30,28)未找到与给定名称匹配的资源(在“ layout_anchor”处,值为“ @ id / map”)。
有关信息,我使用include尝试减小主布局的大小。
对于FAB锚,似乎“ @ id / map”不可见。但是我也许做错了事。
我想您缺少标签ID android:id="@+id/map"
打开你的 @layout/content_main
浮动动作按钮用于特殊类型的提升动作。它们的区别在于浮动在UI上方的带圆圈图标,并具有与变形,发射和转移锚点有关的特殊运动行为。
Error:(30, 28) No resource found that matches the given name (at 'layout_anchor' with value '@id/map').
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句