私のアプリには DrawerLayout が含まれており、その中に appcompat ツールバーが含まれています。引き出しがフラグメントを「開く」とすべて正常に動作しますが、フラグメントからアクティビティを開始するとアクションモードメニューが表示され、ツールバーの上に表示されますが、フラグメントと同じようにツールバーの上に表示します。
この効果は、Android 5.0.1 および KitKat 4.4.2 に存在します。
SOで解決策が見つかりませんでした。
アクションモードメニューが表示されているときに、ツールバーの上にアクションモードのみを表示して修正するにはどうすればよいですか?
下の画像は間違った結果を示しています
これは期待される結果です
呼び出されたアクティビティのレイアウト
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<include layout="@layout/toolbar_app"/>
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
ツールバーのレイアウト
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/my_toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
android:background="?attr/colorPrimary"/>