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


Java SlidingMenu.setTouchModeAbove方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: configSlidingMenu

import com.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
private void configSlidingMenu() {
	SlidingMenu sm = getSlidingMenu();
	sm.setShadowWidth(20);
	sm.setShadowDrawable(R.drawable.shadow);
	sm.setBehindOffset(80);
	sm.setFadeDegree(0.35f);

	// 设置slding menu的几种手势模式
	// TOUCHMODE_FULLSCREEN 全屏模式,在content页面中,滑动,可以打开sliding menu
	// TOUCHMODE_MARGIN 边缘模式,在content页面中,如果想打开slding ,你需要在屏幕边缘滑动才可以打开slding
	// menu
	// TOUCHMODE_NONE 自然是不能通过手势打开啦
	sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
}
 
开发者ID:yongbo000,项目名称:wakao-app,代码行数:15,代码来源:MainActivity2.java

示例6: 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

示例7: 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

示例8: 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

示例9: onCreate

import com.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	
	// set the Above View
	if (savedInstanceState != null)
		mContent = getSupportFragmentManager().getFragment(savedInstanceState, "mContent");
	if (mContent == null)
		mContent = new MainPageFragment();	
	
	// set the Above View
	setContentView(R.layout.fragment_content);
	getSupportFragmentManager()
	.beginTransaction()
	.replace(R.id.content_frame, mContent)
	.commit();
	
	// set the Behind View(Menu)
	setBehindContentView(R.layout.fragment_menu);
	getSupportFragmentManager()
	.beginTransaction()
	.replace(R.id.menu_frame, new MenuFragment())
	.commit();
	
	// customize the SlidingMenu
	SlidingMenu sm = getSlidingMenu();
	sm.setFadeDegree(1.0f);
	sm.setMode(SlidingMenu.RIGHT);//Direction of the menu
	sm.setBehindWidth(250);
	
	sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
}
 
开发者ID:tangren03,项目名称:SlidingMenuDemo,代码行数:34,代码来源:MainSlidingMenuActivity.java

示例10: initializeMenu

import com.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
private void initializeMenu() {
	setBehindContentView(R.layout.hidden_menu);
	SlidingMenu menu = getSlidingMenu();
	menu.invalidate();
	menu.setBehindWidthRes(R.dimen.menu_offset);
	menu.setFadeDegree(0.35f);
	menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
}
 
开发者ID:nicolaperantoni,项目名称:Reminiscence,代码行数:9,代码来源:BaseActivity.java

示例11: onCreate

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

	// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
	// WindowManager.LayoutParams.FLAG_FULLSCREEN);

	SysApplication.getInstance().addActivity(this); // �����ٶ��������this
	setContentView(R.layout.paychart);
	// set the Behind View
	setBehindContentView(R.layout.frame_menu);

	SystemBarTintManager mTintManager;
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
		setTranslucentStatus(true);
	}
	mTintManager = new SystemBarTintManager(this);
	mTintManager.setStatusBarTintEnabled(true);
	mTintManager.setStatusBarTintResource(R.color.fragment2);

	payDAO = new PayDAO(PayChart.this);
	KindDatap = new ArrayList<KindData>();
	ptypeDAO = new PtypeDAO(PayChart.this);
	incomeDAO = new IncomeDAO(PayChart.this);
	itypeDAO = new ItypeDAO(PayChart.this);

	FragmentTransaction fragmentTransaction = getFragmentManager()
			.beginTransaction();
	MenuFragment menuFragment = new MenuFragment();
	fragmentTransaction.replace(R.id.menu, menuFragment);
	fragmentTransaction.commit();

	// customize the SlidingMenu
	SlidingMenu sm = getSlidingMenu();
	sm.setMode(SlidingMenu.LEFT);
	sm.setShadowWidth(50);
	sm.setShadowDrawable(R.drawable.shadow);
	sm.setBehindOffset(260);
	sm.setFadeDegree(0.4f);
	// ����slding menu�ļ�������ģʽ
	// TOUCHMODE_FULLSCREEN ȫ��ģʽ����contentҳ���У����������Դ�sliding menu
	// TOUCHMODE_MARGIN ��Եģʽ����contentҳ���У�������slding ,����Ҫ����Ļ��Ե�����ſ��Դ�slding
	// menu
	// TOUCHMODE_NONE ��Ȼ�Dz���ͨ�����ƴ���
	sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);

	// ʹ�����Ϸ�icon�ɵ㣬������onOptionsItemSelected����ſ��Լ�����R.id.home
	// getActionBar().setDisplayHomeAsUpEnabled(true);

	initView();

}
 
开发者ID:linmp4,项目名称:quickmark,代码行数:54,代码来源:PayChart.java

示例12: 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

示例13: onCreate

import com.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(null);
        if (!EResources.init(this)) {
            loadResError();
            return;
        }
        if (!AppCan.ACTION_APPCAN_SDK.equals(getIntent().getAction())) {
            startMaskActivity();
        } else {
            startCustomMaskActivity(getIntent());
        }
        mVisable = true;
        Window activityWindow = getWindow();
        ESystemInfo.getIntence().init(this);
        mBrowser = new EBrowser(this);
        mEHandler = new EHandler(Looper.getMainLooper());
        initEngineUI();
        mBrowserAround = new EBrowserAround(this);
        setContentView(mEBrwMainFrame);
        initInternalBranch();

        Message loadDelayMsg = mEHandler
                .obtainMessage(EHandler.F_MSG_LOAD_HIDE_SH);
        long delay = 3 * 1000L;
        if (mSipBranch) {
            delay = 1000L;
        }
        mEHandler.sendMessageDelayed(loadDelayMsg, delay);

        WWidgetData wWidgetData=getIntent().getParcelableExtra(KET_WIDGET_DATE);
        getIntent().removeExtra(KET_WIDGET_DATE);//删除intent中的数据,避免传递给网页
        // maybe start by other app
        if (wWidgetData == null || TextUtils.isEmpty(wWidgetData.m_indexUrl)) {
            wWidgetData = AppCan.getInstance().getRootWidgetData();
        }
        initEngine(wWidgetData);

        EUtil.printeBackup(savedInstanceState, "onCreate");
        // EUtil.checkAndroidProxy(getBaseContext());

        handleIntent(getIntent());
        PushRecieveMsgReceiver.setContext(this);


        globalSlidingMenu = new SlidingMenu(this);
        globalSlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);


//        globalSlidingMenu.setShadowWidthRes(EUExUtil.getResDimenID("shadow_width"));
//        globalSlidingMenu.setShadowDrawable(EUExUtil.getResDrawableID("shadow"));

//        globalSlidingMenu.setShadowWidthRes(R.dimen.shadow_width);
//        globalSlidingMenu.setShadowDrawable(R.drawable.shadow);
//        globalSlidingMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
//        globalSlidingMenu.setFadeDegree(0.35f);
//        globalSlidingMenu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
//        globalSlidingMenu.setMenu(R.layout.menu_frame);
//        globalSlidingMenu.setMode(SlidingMenu.LEFT_RIGHT);
//
//        globalSlidingMenu.setSecondaryMenu(R.layout.menu_frame_two);
//        globalSlidingMenu.setSecondaryShadowDrawable(R.drawable.shadowright);
//        globalSlidingMenu.setBehindWidthRes(R.dimen.slidingmenu_width);
//        globalSlidingMenu.setBehindWidthRes(0);
        reflectionPluginMethod("onActivityCreate");
        try {
            activityWindow.clearFlags(
                    WindowManager.LayoutParams.class.getField(
                            "FLAG_NEEDS_MENU_KEY").getInt(null));
        } catch (Exception e) {
        }
    }
 
开发者ID:AppCanOpenSource,项目名称:appcan-android,代码行数:73,代码来源:EBrowserActivity.java

示例14: 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

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