当前位置: 首页>>代码示例>>Java>>正文


Java SlidingMenu.setBehindOffsetRes方法代码示例

本文整理汇总了Java中com.slidingmenu.lib.SlidingMenu.setBehindOffsetRes方法的典型用法代码示例。如果您正苦于以下问题:Java SlidingMenu.setBehindOffsetRes方法的具体用法?Java SlidingMenu.setBehindOffsetRes怎么用?Java SlidingMenu.setBehindOffsetRes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.slidingmenu.lib.SlidingMenu的用法示例。


在下文中一共展示了SlidingMenu.setBehindOffsetRes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configSlidingMenu

import com.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
private void configSlidingMenu(boolean phone) {
    SlidingMenu slidingMenu = getSlidingMenu();
    slidingMenu.setShadowWidthRes(R.dimen.shadow_width);
    slidingMenu.setShadowDrawable(R.drawable.shadow);
    if (phone)
        slidingMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    else
        slidingMenu.setBehindOffset(Utility.getScreenWidth());

    slidingMenu.setFadeDegree(0.35f);
    slidingMenu.setOnPageScrollListener(new SlidingMenu.OnPageScrollListener() {
        @Override
        public void onPageScroll() {
            LongClickableLinkMovementMethod.getInstance().setLongClickable(false);
            (getFriendsTimeLineFragment()).clearActionMode();
        }
    });

    slidingMenu.setOnClosedListener(new SlidingMenu.OnClosedListener() {
        @Override
        public void onClosed() {
            LongClickableLinkMovementMethod.getInstance().setLongClickable(true);
            LocalBroadcastManager.getInstance(MainTimeLineActivity.this).sendBroadcast(new Intent(AppEventAction.SLIDING_MENU_CLOSED_BROADCAST));
        }
    });
}
 
开发者ID:dingyu,项目名称:Dingyu,代码行数:27,代码来源:MainTimeLineActivity.java

示例2: onCreate

import com.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	setTitle(R.string.attach);

	// set the Above View
	setContentView(R.layout.content_frame);
	getSupportFragmentManager().beginTransaction()
			.replace(R.id.content_frame, new SampleListFragment()).commit();

	// configure the SlidingMenu
	menu = new SlidingMenu(this);
	menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
	menu.setShadowWidthRes(R.dimen.shadow_width);
	menu.setShadowDrawable(R.drawable.shadow);
	menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
	menu.setFadeDegree(0.35f);
	menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
	menu.setMenu(R.layout.menu_frame);
	getSupportFragmentManager().beginTransaction()
			.replace(R.id.menu_frame, new SampleListFragment()).commit();
}
 
开发者ID:BusinessWechat,项目名称:YikuairAndroid,代码行数:24,代码来源:AttachExample.java

示例3: onCreate

import com.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	setTitle(mTitleRes);

	// set the Behind View
	setBehindContentView(R.layout.menu_frame);
	FragmentTransaction t = this.getSupportFragmentManager().beginTransaction();
	mFrag = new SampleListFragment();
	t.replace(R.id.menu_frame, mFrag);
	t.commit();
	
	// customize the SlidingMenu
	SlidingMenu sm = getSlidingMenu();
	// Test
	sm.setSecondaryMenu(R.layout.properties);
	sm.setShadowWidthRes(R.dimen.shadow_width);
	sm.setShadowDrawable(R.drawable.shadow);
	sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
	sm.setFadeDegree(0.35f);
	sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);

	getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
 
开发者ID:BusinessWechat,项目名称:YikuairAndroid,代码行数:26,代码来源:BaseActivity.java

示例4: onCreate

import com.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // set the Behind View
    setBehindContentView(R.layout.menu_frame);
    FragmentTransaction t = this.getSupportFragmentManager()
            .beginTransaction();
    mFrag = new LeftMenuFragment();
    t.replace(R.id.menu_frame, mFrag);
    t.commit();

    // customize the SlidingMenu
    SlidingMenu sm = getSlidingMenu();
    sm.setShadowWidthRes(R.dimen.shadow_width);
    sm.setShadowDrawable(R.drawable.shadow);
    sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    sm.setFadeDegree(0.35f);
    sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
}
 
开发者ID:iamyup,项目名称:cultureshock,代码行数:20,代码来源:ListSlidingActivity.java

示例5: configSlidingMenu

import com.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
private void configSlidingMenu(boolean phone) {
    SlidingMenu slidingMenu = getSlidingMenu();
    slidingMenu.setShadowWidthRes(R.dimen.shadow_width);
    slidingMenu.setShadowDrawable(R.drawable.shadow_slidingmenu);
    if (phone) {
        slidingMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    } else {
        slidingMenu.setBehindOffset(Utility.getScreenWidth());
    }

    slidingMenu.setFadeDegree(0.35f);
    slidingMenu.setOnPageScrollListener(new SlidingMenu.OnPageScrollListener() {
        @Override
        public void onPageScroll() {
            LongClickableLinkMovementMethod.getInstance().setLongClickable(false);
            (getFriendsTimeLineFragment()).clearActionMode();
            (getFavFragment()).clearActionMode();
            (getCommentsTimeLineFragment()).clearActionMode();
            (getMentionsTimeLineFragment()).clearActionMode();
            (getMyProfileFragment()).clearActionMode();

            if (GlobalContext.getInstance().getAccountBean().isBlack_magic()) {
                (getSearchFragment()).clearActionMode();
                (getDMFragment()).clearActionMode();
            }
        }
    });

    slidingMenu.setOnClosedListener(new SlidingMenu.OnClosedListener() {
        @Override
        public void onClosed() {
            LongClickableLinkMovementMethod.getInstance().setLongClickable(true);
            LocalBroadcastManager.getInstance(MainTimeLineActivity.this)
                    .sendBroadcast(new Intent(AppEventAction.SLIDING_MENU_CLOSED_BROADCAST));
        }
    });
}
 
开发者ID:shawnlinboy,项目名称:siciyuan,代码行数:38,代码来源:MainTimeLineActivity.java

示例6: setupMenu

import com.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
private void setupMenu() {
	menu = new SlidingMenu(this);
	menu.setMode(SlidingMenu.LEFT);
	menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
	menu.setFadeDegree(0.35f);
	menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
	menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
	menu.setOnOpenListener(new OnOpenListener() {

		@Override
		public void onOpen() {
			if (confManager != null) {
				adapter = new ArrayAdapter<String>(MainActivity.this,
						R.layout.slidingmenu);
				ListView l = new ListView(MainActivity.this);
				final List<MenuItem<?>> m = confManager.getMenuActions();
				for (int i = 0; i < m.size(); i++) {
					adapter.add(m.get(i).getKey());
				}
				// for (MenuItem<?> s : m) {
				// adapter.add(s.getKey());
				// }
				l.setAdapter(adapter);
				l.setOnItemClickListener(new OnItemClickListener() {

					@Override
					public void onItemClick(AdapterView<?> parent,
							View view, int position, long id) {
						menu.showContent();
						confManager.menuClick(m.get(position).getValue());
						// loadControllerUrl(m.get(position).getValue(),
						// true);
					}
				});
				menu.setMenu(l);
			}
		}
	});
}
 
开发者ID:hasier,项目名称:adappt-it,代码行数:40,代码来源:MainActivity.java

示例7: onCreate

import com.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle arg0) {
	super.onCreate(arg0);

	mMenu = new SlidingMenu(this);
	mMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
	mMenu.setBehindScrollScale(1f);
	mMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
	mMenu.setFadeEnabled(true);
	mMenu.setFadeDegree(0.35f);
	mMenu.attachToActivity(this, SlidingMenu.SLIDING_WINDOW);
	mMenu.setMenu(R.layout.sliding_menu_frame);
	mMenu.setOnOpenedListener(new SlidingMenu.OnOpenedListener() {
		
		@Override
		public void onOpened() {
			TopFragment fragment = (TopFragment) getSupportFragmentManager().findFragmentById(R.id.top_content);
			if(fragment != null) {
				fragment.onMenuOpen();
			}
		}
	});

	MenuFragment menuFragment = new MenuFragment();
	menuFragment.setListener(mMenuListener);
	getSupportFragmentManager().beginTransaction().replace(R.id.sliding_menu, menuFragment)
			.commit();

	mMenu.setContent(R.layout.actvy_top);
	
	if(getIntent() != null) {
		int page = getIntent().getIntExtra(Const.Intent.SwitchPage, TopFragmentType.NearAppoint.getValue());
		change(TopFragmentType.find(page), getIntent().getExtras());
	} else {
		change(TopFragmentType.NearAppoint, null);
	}

	upgrade();
}
 
开发者ID:tassadar2002,项目名称:ouser,代码行数:40,代码来源:TopActivity.java

示例8: onCreate

import com.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	setTitle(R.string.attach);

	// set the Above View
	setContentView(R.layout.content_frame);
	getSupportFragmentManager()
	.beginTransaction()
	.replace(R.id.content_frame, new SampleListFragment())
	.commit();

	// configure the SlidingMenu
	menu = new SlidingMenu(this);
	menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
	menu.setShadowWidthRes(R.dimen.shadow_width);
	menu.setShadowDrawable(R.drawable.shadow);
	menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
	menu.setFadeDegree(0.35f);
	menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
	menu.setMenu(R.layout.menu_frame);
	getSupportFragmentManager()
	.beginTransaction()
	.replace(R.id.menu_frame, new SampleListFragment())
	.commit();
}
 
开发者ID:androidroadies,项目名称:SlidingMenu-master,代码行数:28,代码来源:AttachExample.java

示例9: onCreate

import com.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mHelper = new SlidingActivityHelper(this);
    mHelper.onCreate(savedInstanceState);

    setBehindContentView(R.layout.menu_frame);

    if (checkLogin())
        return;
    navigateToFeed();
    FragmentTransaction ft = this.getSupportFragmentManager()
            .beginTransaction();

    mNotificationFragment = MenuFragment.newInstance();
    ft.replace(R.id.menu_frame, mNotificationFragment);

    ft.commit();

    SlidingMenu sm = getSlidingMenu();
    sm.setShadowWidthRes(R.dimen.shadow_width);
    sm.setShadowDrawable(R.drawable.slide_shadow);
    sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    sm.setAboveOffsetRes(R.dimen.slidingmenu_offset);
    sm.setFadeDegree(0.3f);
    sm.setOnOpenedListener(mNotificationFragment);
    sm.setOnClosedListener(mNotificationFragment);

    sm.setMode(SlidingMenu.RIGHT);
    sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    setContentView(R.layout.main_activity);
}
 
开发者ID:cuipengpeng,项目名称:p1-android,代码行数:33,代码来源:MainActivity.java

示例10: onCreate

import com.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	menu = new SlidingMenu(this);
	setContentView(R.layout.activity_main);
	
	SharedPreferences config = getSharedPreferences("config", Activity.MODE_PRIVATE);
	Editor edit = config.edit();
	edit.putInt("versionCode", DirverInformations.versionCode(this)).commit();
	edit.putBoolean("isFirst", false).commit(); 
	
	button[0]=(ImageView)findViewById(R.id.main_button_11);
	button[1]=(ImageView)findViewById(R.id.main_button_12);
	button[2]=(ImageView)findViewById(R.id.main_button_13);
	button[3]=(ImageView)findViewById(R.id.main_button_21);
	button[4]=(ImageView)findViewById(R.id.main_button_22);
	button[5]=(ImageView)findViewById(R.id.main_button_23);
	button[6]=(ImageView)findViewById(R.id.main_button_31);
	button[7]=(ImageView)findViewById(R.id.main_button_32);
	
	for(int i=0;i<button.length;i++){
		button[i].setOnClickListener(new ButtonListener(i));
	}
	
	// ��ʼ��ҳ��
	
	double weight = DirverInformations.weight(this);
	Log.v("tag", "weight is "+weight);
	double height = (weight/56.0)*36.0;
	Log.v("tag", "height is"+height);
	height_sub=(int)height+1;
	Log.v("tag", "height_sub is"+height_sub);
	
	slidingmenu_weight=(int)(weight/2);
	Log.v("tag", "slidingmenu_weight is"+slidingmenu_weight);
	
	initViews();
	initDots();
	
	
	
	menu.setMode(SlidingMenu.RIGHT);//���ò˵���λ��
       menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);//���ò˵���������ʽ
       menu.setShadowWidthRes(R.dimen.shadow_width);
       menu.setShadowDrawable(R.drawable.shadow);//�˵�����ʱ��Ӱ����
       menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
       menu.setBehindWidth(slidingmenu_weight);//�˵����
       menu.setFadeDegree(0.35f);
       menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
       menu.setMenu(R.layout.slidingmenu_layout);//��Ӳ˵�
       menuinit();
       
	
    /*   
	Button testbutton=(Button)findViewById(R.id.main_slidingmenu_button);
	testbutton.setOnClickListener(new OnClickListener() {
		
		@Override
		public void onClick(View arg0) {
			Log.v("tag", "ttt");
			Toast.makeText(MainActivity.this,"����˰�ť", Toast.LENGTH_SHORT).show();
		}
	});*/
       
}
 
开发者ID:sunhongyue4500,项目名称:SDUnews,代码行数:66,代码来源:MainActivity.java

示例11: onCreate

import com.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	Log.e("test", "responsiveUIActivity on create...........");
	instance = this;
	setContentView(R.layout.responsive_content_frame);
	if (getSupportActionBar() != null)
		getSupportActionBar().hide();

	ClientSocket client = new ClientSocket(this);
	if (client.socket != null)
		Log.e("test", "client.socket != null...................");
	else
		Log.e("test", "client.socket == null...................");

	// check if the content frame contains the menu frame
	if (findViewById(R.id.menu_frame) == null) {
		setBehindContentView(R.layout.menu_frame);
		getSlidingMenu().setSlidingEnabled(true);
		getSlidingMenu()
				.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE/* TOUCHMODE_FULLSCREEN */);
		// show home as up so we can toggle
		if (getSupportActionBar() != null)
			getSupportActionBar().setDisplayHomeAsUpEnabled(true);
	} else {
		// add a dummy view
		View v = new View(this);
		setBehindContentView(v);
		getSlidingMenu().setSlidingEnabled(false);
		getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
	}
	// set the Above View Fragment
	if (savedInstanceState != null)
		mContent = getSupportFragmentManager().getFragment(
				savedInstanceState, "mContent");
	if (mContent == null)
		mContent = new MessageFragment()/* BirdGridFragment(0) */;
	getSupportFragmentManager().beginTransaction()
			.replace(R.id.content_frame, mContent).commit();

	// set the Behind View Fragment
	getSupportFragmentManager().beginTransaction()
			.replace(R.id.menu_frame, new MenuFragment()).commit();

	// customize the SlidingMenu
	SlidingMenu sm = getSlidingMenu();
	sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
	sm.setShadowWidthRes(R.dimen.shadow_width);
	sm.setShadowDrawable(R.drawable.shadow);
	sm.setBehindScrollScale(0.25f);
	sm.setFadeDegree(0.25f);

	shared = new SharedPreferencesUtil(this);
	Log.e("test", "userinfo.dbid ::" + UserInfo.db_id);
	MessageInfo.groupMap = shared.readGroupMapFromShared(UserInfo.db_id
			+ "_" + YIKUAIR_GROUP);
}
 
开发者ID:BusinessWechat,项目名称:YikuairAndroid,代码行数:58,代码来源:ResponsiveUIActivity.java

示例12: onCreate

import com.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // set the window pixel format to fix an alpha blending issue in Android 2.2 and under
    getWindow().setFormat(PixelFormat.RGBA_8888);

    setContentView(R.layout.activity_main);

    final SlidingMenuFragment slidingMenuFragment =
        (SlidingMenuFragment)getSupportFragmentManager().findFragmentById(R.id.menu_fragment);

    final ActionBar actionBar = getSupportActionBar();

    // ensure the sliding menu fragment doesn't exist or that it is isn't the layout, if it
    // doesn't exist then the device is a phone, if it exists then the device is most likely
    // a tablet in landscape mode with the sliding menu permanently displayed
    if (slidingMenuFragment == null || !slidingMenuFragment.isInLayout()) {
        // setup the sliding menu on the left hand side of the activity
        slidingMenu = new SlidingMenu(this);
        slidingMenu.setMode(SlidingMenu.LEFT);
        slidingMenu.setShadowWidthRes(R.dimen.shadow_width);
        slidingMenu.setShadowDrawable(R.drawable.shadow);
        slidingMenu.setBehindOffsetRes(R.dimen.sliding_menu_offset);
        slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
        slidingMenu.setFadeDegree(0.35f);
        slidingMenu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
        slidingMenu.setMenu(R.layout.sliding_menu_frame);

        getSupportFragmentManager().beginTransaction()
            .replace(R.id.menu_frame, new SlidingMenuFragment()).commit();

        // setup the action bar enabling the home button to toggle the visibility of the sliding
        // menu
        actionBar.setIcon(R.drawable.spaced_logo);
        actionBar.setDisplayHomeAsUpEnabled(true);
    } else {
        actionBar.setIcon(R.drawable.right_spaced_logo);
    }

    // determine whether the activity has saved instance data, indicating the activity has
    // existed before
    if (savedInstanceState != null) {
        setActionBarTitle(categoryManager.getSelectedCategory());
    } else {
        // if there is no saved instance but a category has been selected, the application
        // has been restarted from the multi-task view and needs to be manually refreshed
        if (categoryManager.getSelectedCategory() != null) {
            onCategoryChanged(categoryManager.getPrimaryCategory());
        }
    }
}
 
开发者ID:jackwakefield,项目名称:TorrentFreak-Reader,代码行数:53,代码来源:MainActivity.java

示例13: onCreate

import com.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setTitle(R.string.responsive_ui);

	setContentView(R.layout.responsive_content_frame);

	// check if the content frame contains the menu frame
	if (findViewById(R.id.menu_frame) == null) {
		setBehindContentView(R.layout.menu_frame);
		getSlidingMenu().setSlidingEnabled(true);
		getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
		// show home as up so we can toggle
		getSupportActionBar().setDisplayHomeAsUpEnabled(true);
	} else {
		// add a dummy view
		View v = new View(this);
		setBehindContentView(v);
		getSlidingMenu().setSlidingEnabled(false);
		getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
	}

	// set the Above View Fragment
	if (savedInstanceState != null)
		mContent = getSupportFragmentManager().getFragment(savedInstanceState, "mContent");
	if (mContent == null)
		mContent = new BirdGridFragment(0);	
	getSupportFragmentManager()
	.beginTransaction()
	.replace(R.id.content_frame, mContent)
	.commit();

	// set the Behind View Fragment
	getSupportFragmentManager()
	.beginTransaction()
	.replace(R.id.menu_frame, new BirdMenuFragment())
	.commit();

	// customize the SlidingMenu
	SlidingMenu sm = getSlidingMenu();
	sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
	sm.setShadowWidthRes(R.dimen.shadow_width);
	sm.setShadowDrawable(R.drawable.shadow);
	sm.setBehindScrollScale(0.25f);
	sm.setFadeDegree(0.25f);

	// show the explanation dialog
	if (savedInstanceState == null)
		new AlertDialog.Builder(this)
		.setTitle(R.string.what_is_this)
		.setMessage(R.string.responsive_explanation)
		.show();
}
 
开发者ID:androidroadies,项目名称:SlidingMenu-master,代码行数:54,代码来源:ResponsiveUIActivity.java

示例14: onCreate

import com.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTitle(R.string.app_name);

    setContentView(R.layout.content_frame);

    // check if the content frame contains the menu frame
    if (findViewById(R.id.menu_frame) == null) {
        setBehindContentView(R.layout.menu_frame);
        getSlidingMenu().setSlidingEnabled(true);
        getSlidingMenu()
                .setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
        // show home as up so we can toggle
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    } else {
        // add a dummy view
        View v = new View(this);
        setBehindContentView(v);
        getSlidingMenu().setSlidingEnabled(false);
        getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
    }

    // set the Above View Fragment
    if (savedInstanceState != null) {
        mContent = getSupportFragmentManager().getFragment(
                savedInstanceState, "mContent");
        if (mContent == null)
            mContent = new ArticleListFragment();
        getSupportFragmentManager().beginTransaction()
                .replace(R.id.content_frame, mContent).commit();
        // here we should concern about SlidingMenu's request and response
    }

    // set the Behind View Fragment
    getSupportFragmentManager().beginTransaction()
            .replace(R.id.menu_frame, new SlidingMenuFragment()).commit();

    // customize the SlidingMenu
    SlidingMenu sm = getSlidingMenu();
    sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    sm.setShadowWidthRes(R.dimen.shadow_width);
    sm.setShadowDrawable(R.drawable.shadow);
    sm.setBehindScrollScale(0.25f);
    sm.setFadeDegree(0.25f);
    BusProvider.getInstance().register(this);
}
 
开发者ID:IceskYsl,项目名称:tagskill_android_app,代码行数:48,代码来源:ArticleListActivity.java

示例15: initSM

import com.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
void initSM() {
	SlidingMenu sm = getSlidingMenu();
	sm.setShadowWidthRes(R.dimen.shadow_width);
	sm.setShadowDrawable(R.drawable.shadow);
	sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
	sm.setFadeDegree(0.35f);
	sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
	
	getSupportActionBar().setDisplayHomeAsUpEnabled(true);
	setSlidingActionBarEnabled(true);
	
	//set the actual slide menu
	setBehindContentView(R.layout.slidemenu);
	
	//fill the slide menu
	final ListView stations = (ListView)findViewById(R.id.stations);
	stations.setAdapter(new SlideMenuAdapter(this, new String[] { "Reisplanner", "Vertrektijden" }));
	
	final ListView nieuws = (ListView)findViewById(R.id.nieuws);
	nieuws.setAdapter(new SlideMenuAdapter(this, new String[] { "Storingen", "Werkzaamheden" }));
	
	final ListView applicatie = (ListView)findViewById(R.id.applicatie);
	applicatie.setAdapter(new SlideMenuAdapter(this, new String[] { "Instellingen", "Over" }));
	
	//set up event handlers

       SlidingMenu.OnOpenListener openListener = new SlidingMenu.OnOpenListener() {
           @Override
           public void onOpen() {
               //hide keyboard if slidemenu is showing (looks ugly if it does)
               InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
               if (inputMethodManager != null && inputMethodManager.isAcceptingText()) {
                   inputMethodManager.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
               }
           }
       };
	
	OnItemClickListener clickevent = new OnItemClickListener() {

		@Override
		public void onItemClick(AdapterView<?> list, View parent, int index,
				long arg3) {
			String name = (String)list.getAdapter().getItem(index);

			toggle();
			
			if(name.equals("Reisplanner")) {
				switchTo(new PlannerFragment());
			} else if(name.equals("Over")) {
				switchTo(new AboutFragment());
			} else if(name.equals("Storingen") || name.equals("Werkzaamheden")) {
				MaintenanceFragment maintenance = new MaintenanceFragment();
				Bundle args = new Bundle();
				if(name.equals("Storingen"))
					args.putBoolean("storingen", true);
				
				maintenance.setArguments(args);
				switchTo(maintenance);
			} else {
				Log.w("BASEPLANNER", "Unrecognized list item selected: "+name);
			}
			
		} 
	};

       getSlidingMenu().setOnOpenListener(openListener);

	applicatie.setOnItemClickListener(clickevent);
	nieuws.setOnItemClickListener(clickevent);
	stations.setOnItemClickListener(clickevent);
}
 
开发者ID:jariz,项目名称:Reisplanner,代码行数:72,代码来源:BasePlannerActivity.java


注:本文中的com.slidingmenu.lib.SlidingMenu.setBehindOffsetRes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。