1
レイアウトを this (design preview in Android Studio)のようにしたい。ツールバーとフローティングアクションボタンが正しく表示されない
悲しいことに、アプリケーションをデバッグモードで実行すると、エミュレータ(just half of the toolbar is visible and the fab not at all)が表示されます。
layout.xml
ファイルにapp:layout_scrollFlags="scroll|enterAlways"
を適用しましたが、私のToolbar
もトップに固定されています。
layout.xml
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/anim_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways">
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:id="@+id/imageview_main"
android:scaleType="fitXY"
android:src="@drawable/test"
android:layout_height="match_parent"
android:layout_weight="0.3"/>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/recyclerview"
android:layout_weight="0.7">
</android.support.v7.widget.RecyclerView>
</LinearLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_menu_camera"
app:borderWidth="0dp"
android:layout_marginRight="15dp"
app:layout_anchor="@id/appbar"
app:layout_anchorGravity="bottom|right|end" />
すべてのヘルプは理解されるであろう。
'アンドロイドを削除するようにしてください:AppBarLayout' – Lamorak
'からツールバーが完全に今 'fitsSystemWindows =「true」を示しているが、フローティング操作ボタンは、まだ事前のおかげが不足してい@Lamorak –