1

有人可以帮我解决这个问题吗?我在这里被困了一段时间。我正在从伟大的开源项目 FBReader for android 制作 ae Pub 阅读器。问题出在我的应用程序的按钮上。当我单击按钮时,我需要运行选项菜单上提供的相同功能。请帮我。

    protected void onCreate(Bundle icicle) 
    {
    super.onCreate(icicle);
        myFBReaderApp.addAction(ActionCode.SHOW_LIBRARY, new ShowLibraryAction(this,    myFBReaderApp));
        myFBReaderApp.addAction(ActionCode.SHOW_PREFERENCES, new ShowPreferencesAction(this, myFBReaderApp));
        myFBReaderApp.addAction(ActionCode.SHOW_BOOK_INFO, new ShowBookInfoAction(this, myFBReaderApp));

    ImageView plus = (ImageView) findViewById(R.id.BookMarkCropButton);
         plus.setOnClickListener(new View.OnClickListener() {
             public void onClick(View v) {

**HERE IS THE PROBLEM**
            }
         });



@Override

 public boolean onPrepareOptionsMenu(Menu menu) {
            final ZLAndroidLibrary zlibrary = (ZLAndroidLibrary)ZLibrary.Instance();
            if (!zlibrary.isKindleFire() && !zlibrary.ShowStatusBarOption.getValue()) {
                getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
            }

            setupMenu(menu);

            return super.onPrepareOptionsMenu(menu);
        }

        @Override
        public void onOptionsMenuClosed(Menu menu) {
            super.onOptionsMenuClosed(menu);
            final ZLAndroidLibrary zlibrary = (ZLAndroidLibrary)ZLibrary.Instance();
            if (!zlibrary.isKindleFire() && !zlibrary.ShowStatusBarOption.getValue()) {
                getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
            }
        }

        @Override
        public boolean onOptionsItemSelected(MenuItem item) {
            final ZLAndroidLibrary zlibrary = (ZLAndroidLibrary)ZLibrary.Instance();
            if (!zlibrary.isKindleFire() && !zlibrary.ShowStatusBarOption.getValue()) {
                getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
            }
            return super.onOptionsItemSelected(item);
        }
4

1 回答 1

0

最后我得到了答案。这可以通过简单地调用与所需功能关联的ACTON_CODE来完成。

于 2013-11-20T16:02:19.010 回答