简体   繁体   中英

action bar sherlock in preference menu

I have a preference menu and i want it to be consistent with the app, so there must be an action bar in top like in the rest of the activities.

i tried it like this

public class Preferencemenu extends PreferenceActivity implements
    OnSharedPreferenceChangeListener {
 .......


 class menuinflater extends BaseActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
         actionbar = getSupportActionBar();
          inflater = getSupportMenuInflater();


    }
}

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    dbHelper = new DataBaseHelper(getApplicationContext());

    Context ctx = getApplicationContext();
    TrainApplication ta = (TrainApplication) getApplication();

    actionbar.setDisplayHomeAsUpEnabled(true);
    actionbar.setHomeButtonEnabled(true);
    menuinflater menu = new menuinflater();
 .....

But ofcourse this doesn't work.

Any ideas?

您需要从SherlockPreferenceActivity扩展。

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