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


Java SlidingMenu.attachToActivity方法代码示例

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


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

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

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

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

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


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