简体   繁体   English

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

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

I created a scrolling activity in Android Studio and I removed the code from the activity that sets the FAB's action, but there is not a matching attribute in the activity xml:我的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>

Everything that I've found on Google says to remove the FAB XML attribute as well to stop it from showing up, but that seems outdated because it is not there.我在 Google 上找到的所有内容都说要删除 FAB XML 属性以阻止它出现,但这似乎已经过时了,因为它不存在。 Where can I go to remove this?我可以去哪里删除它? Thank you.谢谢你。

When you generate a Scrolling Activity it will generate 2 xml files called activity_scrolling.xml and content_scrolling.xml .当您生成滚动活动时,它将生成 2 个 xml 文件,分别称为activity_scrolling.xmlcontent_scrolling.xml Just remove the FAB block from the activity_scrolling.xml file.只需从activity_scrolling.xml文件中删除FAB 块。

Delete this block:删除这个块:

<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" />

Right click layout folder then click Find in path右键单击布局文件夹,然后单击在路径中查找

Search Floating搜索浮动

Delete the block from there then Ctrl + Enter从那里删除块然后Ctrl + Enter

View image看图片

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

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