public class MainActivity extends FragmentActivity { /** Called when the activity is first created. */ AppSectionsPagerAdapter mAppSectionsPagerAdapter; VIEwPager mVIEwPager; @OverrIDe public voID onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentVIEw(R.layout.activity_main); this.getwindow().setFlags(WindowManager.LayoutParams.FLAG_FulLSCREEN,WindowManager.LayoutParams.FLAG_FulLSCREEN); setupActionbar(); mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager()); // user swipes between sections. mVIEwPager = (VIEwPager) findVIEwByID(R.ID.pager); mVIEwPager.setAdapter(mAppSectionsPagerAdapter); mVIEwPager.setonPagechangelistener(new OnPagechangelistener() { public voID onPageSelected(int position) { } public voID onPageScrolled(int position,float positionOffset,int positionOffsetPixels) { } public voID onPageScrollStateChanged(int state) { if (state == VIEwPager.SCRolL_STATE_DRAGGING) { } if (state == VIEwPager.SCRolL_STATE_IDLE) { } } }); } public static class AppSectionsPagerAdapter extends FragmentPagerAdapter { public AppSectionsPagerAdapter(FragmentManager fm) { super(fm); } @OverrIDe public Fragment getItem(int i) { switch (i) { case 0: return new AllPatIEnt(); case 1: //Intent intent = new Intent(MainActivity.this,abc.class); return new LaunchpadSectionFragment(); } return null; } @OverrIDe public int getCount() { return 2; } } private voID setupActionbar() { Actionbar actionbar = getActionbar(); //actionbar.setdisplayShowHomeEnabled(false); actionbar.setBackgroundDrawable(new colorDrawable(color.WHITE)); actionbar.setdisplayOptions(Actionbar.disPLAY_SHOW_CUSTOM,Actionbar.disPLAY_SHOW_CUSTOM); VIEwGroup v = (VIEwGroup)LayoutInflater.from(this) .inflate(R.layout.header,null); actionbar.setCustomVIEw(v,new Actionbar.LayoutParams(Actionbar.LayoutParams.MATCH_PARENT,Actionbar.LayoutParams.WRAP_CONTENT,Gravity.CENTER_VERTICAL | Gravity.RIGHT)); actionbar.setdisplayShowTitleEnabled(true); actionbar.setTitle(getTitle()); } }
还请告诉我如何在 *** 作栏中的图标之间添加分隔符.
提前致谢.
actionbar.setdisplayOptions(Actionbar.disPLAY_SHOW_CUSTOM,Actionbar.disPLAY_SHOW_CUSTOM);
通过这个:
actionbar.setdisplayOptions(Actionbar.disPLAY_SHOW_HOME,Actionbar.disPLAY_SHOW_CUSTOM);总结
以上是内存溢出为你收集整理的android – ActionBar标题不可见全部内容,希望文章能够帮你解决android – ActionBar标题不可见所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)