Frage

I have an application that works fine on different devices, including Google Nexus 4 (4.4.2), Nexus S (4.1.2) and Samsung S3 (4.1.*), but I am having display issues with menu inflation on S3 and S4 with 4.2.2+ (unconfirmed before that).

What is happening is that in Portrait mode, the menu appears and expands underneath the Tab Fragment (and possibly underneath the entire view). In Landscape, the menu appears and expands to cover the entire view, but above everything. In portrait, no text or icon appears (or at least they aren't visible in the top bit), but in Landscape they do.

A menu already exists and is being covered by the following:

public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
    MenuInflater inflater = getActivity().getMenuInflater();
    inflater.inflate(R.menu.actionmode, menu);
    return true; 
}

R.menu.actionmode:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/actionmode_delete"
    android:title="@string/label_actionmode_delete"
    android:icon="@drawable/actionmode_discard"
    android:showAsAction="always|withText"/>
</menu>

I have no idea what is causing this issue with Samsung S3, S4 with 4.2+.

Update:

Turns out Samsung was doing something weird with this line of code within my style:

<item name="android:actionModeStyle">@style/MyActionMode</item>

Once I removed this line, the UI worked fine, but I still need to find a way to apply the styling I need.

War es hilfreich?

Lösung

Samsung was doing something weird with this line of code within my style:

<item name="android:actionModeStyle">@style/MyActionMode</item>

Luckily, I only required a background colour to be set, so I was able to do the following instead:

<item name="android:actionModeBackground">@color/custom_main_app_color</item>

I know this doesn't really fix the problem, it essentially sidesteps the issue, but it worked for me.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top