我正在尝试将 SlidingMenu 包含到我的应用程序中。它结合了 3 个库 ActionBarSherlock / ViewPagerIndicator / SlidingMenu。那么问题是如果我向右滑动以展开 SlidingMenu 它没有偏移量。这意味着孔屏幕将被菜单填充。如果我按下切换按钮,它看起来真的很奇怪。似乎他得到了偏移,但看图片......如果我按下切换按钮两次,它看起来应该 -.-'
知道我做错了什么吗?
那是我的 layout.xml
<LinearLayout
android:id="@+id/id_Main_output"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="1.0"
android:orientation="vertical" >
<com.viewpagerindicator.TitlePageIndicator
android:id="@+id/id_Main_titlepageindicator"
android:textColor="#FF808080"
app:selectedColor="#FF33B5E5"
app:selectedBold="true"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
/>
<android.support.v4.view.ViewPager
android:id="@+id/id_Main_pager"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
/>
</LinearLayout>
这是我的 onCreate
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_mensaplanhsulm);
setBehindContentView(R.layout.layout_settings);
mPager = (ViewPager)findViewById(R.id.id_Main_pager);
mIndicator = (TitlePageIndicator)findViewById(R.id.id_Main_titlepageindicator);
mAdapter = new DayTitleFragmentAdapter(getSupportFragmentManager());
mPager.setAdapter(mAdapter);
mPager.setCurrentItem(0);
mIndicator.setViewPager(mPager);
SlidingMenu menu = new SlidingMenu(this);
menu.setMode(SlidingMenu.LEFT);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
menu.setShadowWidthRes(R.dimen.shadow_width);
menu.setShadowDrawable(R.drawable.shadow);
menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
menu.setAboveOffset(R.dimen.slidingmenu_offset);
menu.setFadeDegree(0.35f);
menu.attachToActivity(this, SlidingMenu.SLIDING_WINDOW);
menu.setMenu(R.layout.layout_settings);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setSlidingActionBarEnabled(true);