简体   繁体   中英

Android Context menu items text is not showing up

I have recently come across a problem that the context menu items are not showing up for example: http://i.imgur.com/O1EsY1B.png

Current code (Activity)

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo)
{
    super.onCreateContextMenu(menu, v, menuInfo);
    if (v.getId() == R.id.txtTotalOwe)
    {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.menu_edit_contact, menu);
    }
}

And here is the R.menu.menu_edit_contact

<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">

<item android:id="@+id/edit_contact"
      android:title="Edit Contact"
      android:showAsAction="never"
      android:icon="@null"/>

<item android:id="@+id/edit_delete"
      android:title="Delete Contact"
      android:showAsAction="never"
      android:icon="@null"/>

Basically the 2 context menues are displaying, the only problem is the text isn't displaying as it's suppose to.

   super.onCreateContextMenu(menu, v, menuInfo);

        menu.add(0, 0, 0, "Share");
        menu.add(0, 1, 1, "View");
        menu.add(0, 2, 2, "Update");
        menu.add(0, 3, 3, "Delete");
        menu.add(0, 3, 3, "Delete All");

    }

for detailed information visit this site

http://androidcoding.in/2016/03/06/android-tutorial-on-context-menu/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM