繁体   English   中英

如何从自动生成的滚动活动中删除浮动操作按钮

[英]How to remove Floating Action Button from auto generated Scrolling Activity

我的Android Studio中创建一个滚动的活动,我删除从设置FAB的行动,但没有在活动XML匹配属性的活动代码:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="myactivity"
tools:showIn="@layout/activity_edit_address">

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_margin="@dimen/text_margin"
    android:text="@string/large_text" />

</android.support.v4.widget.NestedScrollView>

我在 Google 上找到的所有内容都说要删除 FAB XML 属性以阻止它出现,但这似乎已经过时了,因为它不存在。 我可以去哪里删除它? 谢谢你。

当您生成滚动活动时,它将生成 2 个 xml 文件,分别称为activity_scrolling.xmlcontent_scrolling.xml 只需从activity_scrolling.xml文件中删除FAB 块。

删除这个块:

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_margin="@dimen/fab_margin"
    app:layout_anchor="@id/app_bar"
    app:layout_anchorGravity="bottom|end"
    app:srcCompat="@android:drawable/ic_dialog_email" />

右键单击布局文件夹,然后单击在路径中查找

搜索浮动

从那里删除块然后Ctrl + Enter

看图片

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM