簡體   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