Pregunta

I am working on an app, in which I am want to use a pop-up menu to control some actions and settings. However, when I launch the app in my emulator, the items appear blank, although when I click on them, the action is fired and it works. Here is a screen of the emulator:

enter image description here

I am following the guide, so my code does not differ much from the dev guides, but here is my code:

    @Override
        public boolean onItemLongClick(AdapterView<?> parent, View view,
                int position, long ID)
        {
            // TODO Auto-generated method stub

            courseId = ID;
            fields = sqldbase.query(DBHelper.courseTable, new String[] {
                    DBHelper.courseID, DBHelper.courseName,
                    DBHelper.courseProf, DBHelper.averageGrade },
                    DBHelper.courseID + " = " + ID, null, null, null, null);

            PopupMenu popup = new PopupMenu(getBaseContext(), view);
            popup.getMenuInflater().inflate(R.menu.courses_popup_menu,
                    popup.getMenu());   
            popup.show();
            popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener()
            {

                @Override
                public boolean onMenuItemClick(MenuItem item)
                {
                         Log.i(TAG,"OnMenuItemClick Fired");                                                             return false;

                }

            });

            return false;
        }

    });

Could this be related to a problem with themes? I have been trying to use a Holo.light.NoTitleBar theme, so in my xml in eclipse, the word Passbook does not show, and everything is white, instead of black. However, after running in the emulator, the theme is ignored, and this shows up.

Thanks.

¿Fue útil?

Solución

fixed it. apparently, popup menus use the attribute android:title instead of android:text.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top