Unable to override onCreateOptionsMenu in ListFragment

后端 未结 10 1665
太阳男子
太阳男子 2020-12-24 06:56

I created an app that supports both phone and tablet version so i use the android-support-v4.jar library.

My activity extends the ListFragment and I tried to overri

相关标签:
10条回答
  • 2020-12-24 07:16
    @Override
    public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) {
        // TODO Auto-generated method stub
        getSupportMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    
    0 讨论(0)
  • 2020-12-24 07:21

    i used i used com.actionbarsherlock.view.Menu - maybe it has changed since?

    0 讨论(0)
  • 2020-12-24 07:23

    Make sure the imports are from the compatibility library and not from the SDK itself.

    0 讨论(0)
  • 2020-12-24 07:26

    Try this, actually IDE got confused bw native menu import and Sherlock import..so if we specify it clearly then it will be resolved..

    @Override
        public void onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu,
                com.actionbarsherlock.view.MenuInflater inflater) {
    
    }
    
    @Override
        public boolean onOptionsItemSelected(
                com.actionbarsherlock.view.MenuItem item) {
            // TODO Auto-generated method stub
    
    }
    
    0 讨论(0)
提交回复
热议问题