简体   繁体   中英

Popup menu appears blank

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:

在此处输入图片说明

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.

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

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