gpt4 book ai didi

android - 包含布局的 float 操作按钮 anchor

转载 作者:太空宇宙 更新时间:2023-11-03 13:16:27 24 4
gpt4 key购买 nike

您知道是否可以使用布局中包含的 id View 作为 FAB 的 anchor 吗?例如:

<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 内。

使用此代码,我目前收到以下错误:

Error:(30, 28) No resource found that matches the given name (at 'layout_anchor' with value '@id/map').

有关信息,我正在使用 include 来尝试减小我的主要布局大小。

似乎“@id/map”对于 FAB anchor 是不可见的。但我可能做错了什么。

最佳答案

我猜你缺少Tag Id android:id="@+id/map"

打开你的@layout/content_main

Floating action buttons are used for a special type of promoted action. They are distinguished by a circled icon floating above the UI and have special motion behaviors related to morphing, launching, and the transferring anchor point.

Error:(30, 28) No resource found that matches the given name (at 'layout_anchor' with value '@id/map').

关于android - 包含布局的 float 操作按钮 anchor ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35240118/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com