本文整理汇总了Java中com.slidingmenu.lib.SlidingMenu.setMenu方法的典型用法代码示例。如果您正苦于以下问题:Java SlidingMenu.setMenu方法的具体用法?Java SlidingMenu.setMenu怎么用?Java SlidingMenu.setMenu使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.slidingmenu.lib.SlidingMenu
的用法示例。
在下文中一共展示了SlidingMenu.setMenu方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例2: 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();
}
示例3: 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();
}
示例4: 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();
}
});*/
}
示例5: 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());
}
}
}