0

我有一个首选项菜单,我希望它与应用程序一致,因此顶部必须有一个操作栏,就像其他活动一样。

我试过这样

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();
 .....

但这当然行不通。

有任何想法吗?

4

1 回答 1

1

您需要从SherlockPreferenceActivity.

于 2013-04-25T15:50:06.640 回答