diff --git a/core/java/android/view/LayoutInflater.java b/core/java/android/view/LayoutInflater.java index 577415e9f7d8a..5f3704224ef9f 100644 --- a/core/java/android/view/LayoutInflater.java +++ b/core/java/android/view/LayoutInflater.java @@ -606,9 +606,9 @@ public abstract class LayoutInflater { constructor.setAccessible(true); final View view = constructor.newInstance(args); if (view instanceof ViewStub) { - // always use ourselves when inflating ViewStub later + // Use the same context when inflating ViewStub later. final ViewStub viewStub = (ViewStub) view; - viewStub.setLayoutInflater(this); + viewStub.setLayoutInflater(cloneInContext((Context) args[0])); } return view; diff --git a/core/java/com/android/internal/view/StandaloneActionMode.java b/core/java/com/android/internal/view/StandaloneActionMode.java index fae7ea12fd832..d5d360243e01f 100644 --- a/core/java/com/android/internal/view/StandaloneActionMode.java +++ b/core/java/com/android/internal/view/StandaloneActionMode.java @@ -46,7 +46,8 @@ public class StandaloneActionMode extends ActionMode implements MenuBuilder.Call mContextView = view; mCallback = callback; - mMenu = new MenuBuilder(context).setDefaultShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); + mMenu = new MenuBuilder(view.getContext()).setDefaultShowAsAction( + MenuItem.SHOW_AS_ACTION_IF_ROOM); mMenu.setCallback(this); mFocusable = isFocusable; } @@ -126,7 +127,7 @@ public class StandaloneActionMode extends ActionMode implements MenuBuilder.Call @Override public MenuInflater getMenuInflater() { - return new MenuInflater(mContext); + return new MenuInflater(mContextView.getContext()); } public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) { @@ -141,7 +142,7 @@ public class StandaloneActionMode extends ActionMode implements MenuBuilder.Call return true; } - new MenuPopupHelper(mContext, subMenu).show(); + new MenuPopupHelper(mContextView.getContext(), subMenu).show(); return true; } diff --git a/core/res/res/layout/screen.xml b/core/res/res/layout/screen.xml index 902a797fdadc2..403ffd63debb1 100644 --- a/core/res/res/layout/screen.xml +++ b/core/res/res/layout/screen.xml @@ -30,7 +30,8 @@ This is the basic layout for a screen, with all of its features enabled. android:inflatedId="@+id/action_mode_bar" android:layout="@layout/action_mode_bar" android:layout_width="match_parent" - android:layout_height="wrap_content" /> + android:layout_height="wrap_content" + android:theme="?attr/actionBarTheme" /> + android:layout_height="wrap_content" + android:theme="?attr/actionBarTheme" /> + android:layout_height="wrap_content" + android:theme="?attr/actionBarTheme" /> + android:layout_height="wrap_content" + android:theme="?attr/actionBarTheme" /> + android:layout_height="wrap_content" + android:theme="?attr/actionBarTheme" /> diff --git a/core/res/res/layout/screen_title.xml b/core/res/res/layout/screen_title.xml index f5134f9faba71..409e9c6ec2b39 100644 --- a/core/res/res/layout/screen_title.xml +++ b/core/res/res/layout/screen_title.xml @@ -27,7 +27,8 @@ enabled. android:inflatedId="@+id/action_mode_bar" android:layout="@layout/action_mode_bar" android:layout_width="match_parent" - android:layout_height="wrap_content" /> + android:layout_height="wrap_content" + android:theme="?attr/actionBarTheme" /> + android:layout_height="wrap_content" + android:theme="?attr/actionBarTheme"/>