Unable to override onCreateOptionsMenu in ListFragment

后端 未结 10 1737
太阳男子
太阳男子 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:03

    I had a similar issue using the SherlockActionBar on my activity. Here was my setup that fixed the problem:

    import com.actionbarsherlock.app.SherlockActivity;
    import com.actionbarsherlock.view.Menu;
    
    public class LoginActivity extends SherlockActivity{
    
        ...
    
        @Override
        public boolean onCreateOptionsMenu(Menu menu){
            getSupportMenuInflater().inflate(R.menu.activity_login, menu);
            return true;
        }
    
        ...
    
    }
    

提交回复
热议问题