[英]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.xml
和content_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" />
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.