1

我正在使用 Jeremy Feinstein 的 SlidingMenu 和片段活动和 actionbarsherlock。我活动中的滑动菜单是空白的。

我的滑动菜单的代码来自 Michenux 的教程12

我错过了什么?任何反馈将不胜感激!!

仪表板.java

public class Dashboard extends BaseFragmentActivity {
    DashboardFragment dashFragment;
    private Bundle extras;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getIntent() != null) {
            extras = getIntent().getExtras();
        }

        getSupportActionBar().setIcon(R.drawable.img_activity_logo);
        getSupportActionBar().setDisplayShowTitleEnabled(true);
        getSupportActionBar().setTitle(R.string.dashboardtitle);

        if (arg0 == null) {
            dashFragment = new DashboardFragment();
        if (extras != null) {
            dashFragment.setArguments(extras);
        }

        FragmentManager fragmentManager = this.getSupportFragmentManager();
            fragmentManager.beginTransaction().add(android.R.id.content, dashFragment, "Dashboard").commit();
        }
    }
}

DashboardFragment.java - 我在其中创建滑动菜单:

public class DashboardFragment extends BaseFragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        super.onCreateView(inflater, container, savedInstanceState);
        View view = inflater.inflate(R.layout.dashboard, null);
        return view;
    }

    @Override
    public void onResume() {
        super.onResume();

        slidingMenu = new SlidingMenu(getActivity());
        slidingMenu.setMode(SlidingMenu.RIGHT);
        slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
        slidingMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
        slidingMenu.setFadeDegree(0.35f);
        slidingMenu.attachToActivity(getActivity(), SlidingMenu.SLIDING_WINDOW);
        slidingMenu.setMenu(R.layout.slidingmenu);  
    }

}

BaseFragmentActivity.java

public class BaseFragmentActivity extends SherlockFragmentActivity {
    ...
}

BaseFragment.java

public class BaseFragment extends SherlockFragment {
    ...
}
4

0 回答 0