2017-01-06 14 views
2

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属性を削除して表示を停止すると言われていますが、これは存在しないため古くなったようです。これを取り除くためにどこに行けますか?ありがとうございました。

答えて

4

スクロールアクティビティを生成すると、activity_scrolling.xmlcontent_scrolling.xmlという2つの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" /> 
+0

ありがとうございました、私はそれを逃したのか分かりません。許可されると答えとして受け入れます。 – conjenks

関連する問題