简体   繁体   English

偏好设置菜单中的操作栏夏洛克

[英]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扩展。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM