当前位置: 首页 > news >正文

公司内部网站怎么建设企业网站建设官网

公司内部网站怎么建设,企业网站建设官网,网站建设找酷风,wordpress文章目录在哪里目录 1. BottomNavigationView (1) 准备BottomNavigationView使用的菜单资源文件 (2) 准备颜色选择器 (3) BottomNavigationView控件设置 (4) 在Java代码中设置OnItemSelectedListener监听器 (5) 与Fragment配合 2. BottomTabBar 实现安卓底部导航栏#xff0c;google为…目录 1. BottomNavigationView (1) 准备BottomNavigationView使用的菜单资源文件 (2) 准备颜色选择器 (3) BottomNavigationView控件设置 (4) 在Java代码中设置OnItemSelectedListener监听器 (5) 与Fragment配合 2. BottomTabBar 实现安卓底部导航栏google为我们提供了BottomNavigationView类。第三方提供了简易版BottomTabBar类。 1. BottomNavigationView (1) 准备BottomNavigationView使用的菜单资源文件 res / menu / xxx.xml 使用BottonNavigationView中 app:menu属性 设置。 //例. ?xml version1.0 encodingutf-8? menu xmlns:androidhttp://schemas.android.com/apk/res/androidxmlns:toolshttp://schemas.android.com/toolstools:showInnavigation_viewitem android:idid/item1android:icondrawable/ic_home_mainandroid:titlehome/item android:idid/item2android:icondrawable/ic_home_buttandroid:titlebutt/item android:idid/item3android:icondrawable/ic_home_chatandroid:titlechat/item android:idid/item4android:icondrawable/ic_home_mimeandroid:titlemime/ /menu (2) 准备颜色选择器 BottomNavigationView的颜色通常设置为颜色选择器然后使用 app:itemTextColor属性 设置文字颜色使用 app:itemIconTint属性 设置图标颜色也可不进行设置。 res / color / xxx.xml //例. ?xml version1.0 encodingutf-8? selector xmlns:androidhttp://schemas.android.com/apk/res/androiditem android:colorcolor/purple_700 android:state_checkedtrue/item android:colorcolor/black android:state_checkedfalse/ /selector (3) BottomNavigationView控件设置 com.google.android.material.bottomnavigation.BottomNavigationViewandroid:idid/bottomNavigationViewandroid:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:layout_alignParentBottomtrueapp:menumenu/bottom_navigation_view_menuapp:itemTextColorcolor/my_colorapp:itemIconTintcolor/my_color / (4) 在Java代码中设置OnItemSelectedListener监听器 BottomNavigationView bottomNavigationViewfindViewById(R.id.bottomNavigationView); bottomNavigationView.setOnItemSelectedListener(new NavigationBarView.OnItemSelectedListener() {public boolean onNavigationItemSelected(MenuItem item) {// 选择itemif( item.getItemId() R.id. itemX ){//判断点击的Item的Id是否是指定Item的Id}//必须返回true返回falseBottomNavigationView将不变化return true;} }); (5) 与Fragment配合 BottomNavigationView与Fragment的配合一般通过onItemSelectedListener监听器 获取碎片管理者需使用getSupportFragmentManager()而getFragmentManager()已淘汰 public class MainActivity extends AppCompatActivity {private Fragment f1,f2,f3,f4;private FragmentManager fragmentManager;protected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);f1new Fragment1();f2new Fragment2();f3new Fragment3();f4new Fragment4();//获取碎片管理者需使用getSupportFragmentManager()而getFragmentManager()已淘汰fragmentManagergetSupportFragmentManager();FragmentTransaction fragmentTransaction fragmentManager.beginTransaction();fragmentTransaction.add(R.id.frameLayout,f1);fragmentTransaction.add(R.id.frameLayout,f2);fragmentTransaction.add(R.id.frameLayout,f3);fragmentTransaction.add(R.id.frameLayout,f4);fragmentTransaction.hide(f2);fragmentTransaction.hide(f3);fragmentTransaction.hide(f4);fragmentTransaction.commit();BottomNavigationView bottomNavigationViewfindViewById(R.id.bottomNavigationView);bottomNavigationView.setOnItemSelectedListener(new NavigationBarView.OnItemSelectedListener() {private int nowFragmentR.id.item1;public boolean onNavigationItemSelected(NonNull MenuItem item) {int itemIditem.getItemId();FragmentTransaction fragmentTransaction fragmentManager.beginTransaction();switch (nowFragment){case R.id.item1:fragmentTransaction.hide(f1);break;case R.id.item2:fragmentTransaction.hide(f2);break;case R.id.item3:fragmentTransaction.hide(f3);break;case R.id.item4:fragmentTransaction.hide(f4);break;}switch (itemId){case R.id.item1:fragmentTransaction.show(f1);break;case R.id.item2:fragmentTransaction.show(f2);break;case R.id.item3:fragmentTransaction.show(f3);break;case R.id.item4:fragmentTransaction.show(f4);break;}fragmentTransaction.commit();nowFragmentitemId;return true;}});} } 2. BottomTabBar 该方法于2018.8.25进行最后一次更新不建议使用。 compile com.hjm:BottomTabBar:1.2.2 com.hjm.bottomtabbar.BottomTabBarandroid:idid/bottom_tab_barandroid:layout_widthmatch_parentandroid:layout_heightmatch_parent hjm:tab_bar_background#FFFFFF //BottomTabBar的整体背景颜色hjm:tab_divider_background#FF0000 //分割线背景hjm:tab_font_size14px //文字尺寸hjm:tab_img_font_padding0 //图片文字间隔hjm:tab_img_height70px //图片高度hjm:tab_img_width70px //图片宽度hjm:tab_isshow_dividertrue //是否显示分割线hjm:tab_padding_bottom5px //下边距hjm:tab_padding_top5px //上边距hjm:tab_selected_color#000000 //选中的颜色hjm:tab_unselected_colorcolor/colorPrimary/ //未选中的颜色 mBottomBar findViewById(R.id.bottom_bar);mBottomBar.init(getSupportFragmentManager(), 720, 1280) // .setImgSize(70, 70) // .setFontSize(14) // .setTabPadding(5, 0, 5) // .setChangeColor(Color.parseColor(#FF00F0),Color.parseColor(#CCCCCC)).addTabItem(第一项, R.mipmap.home_selected, R.mipmap.home, OneFragment.class).addTabItem(第二项, R.mipmap.list, TwoFragment.class).addTabItem(第三项, R.mipmap.user, ThreeFragment.class) // .isShowDivider(true) // .setDividerColor(Color.parseColor(#FF0000)) // .setTabBarBackgroundColor(Color.parseColor(#00FF0000)).setOnTabChangeListener(new BottomTabBar.OnTabChangeListener() {Overridepublic void onTabChange(int position, String name, View view) {if (position 1)mBottomBar.setSpot(1, false);}}).setSpot(1, true).setSpot(2, true); 详见超简单几行代码搞定Android底部导航栏 - 简书 (jianshu.com)
http://www.hkea.cn/news/14505680/

相关文章:

  • 国外源码下载网站手机上怎么建网站
  • 网站开发的ie兼容做到9湖南郴州市房价多少一平米
  • 齐河网站建设价格精准营销包括哪几个方面
  • 怎么做刷题网站个人网页可以做什么内容
  • 专门做特价的网站牡丹菏泽网站建设
  • 设计公司网站设计方案找人做网站大概多少钱
  • 做微信平台网站需要多少钱推广学校网站怎么做
  • php做网站项目的思路电商运营怎么做如何从零开始
  • 经典网站首页激活码商城
  • h5网站设计欣赏开一个网店需要多少钱
  • 素材分享网站源码安徽网站建设科技
  • 郴州本地网站建设如何网上申请个人营业执照
  • 广州最好的商城网站制作网站设计论文选题
  • 收费网站设计方案如何做电商赚钱
  • 网站举报官网微奇生活WordPress主题
  • 当当网站开发系统说明wordpress 4.70漏洞
  • 网站建设都包括什么科目oa系统简介
  • 开发网站的好处做电商网站报价
  • 哈尔滨网站建设学校微信网站制作
  • 付网站建设费会计分录wordpress首页广告
  • 网站建设带数据库模板下载自己做的网站与ie不兼容
  • 做的比较好的法律实务培训网站国内哪些网站是php做的
  • 企业建站模板下载自己开发购物网站
  • 用u盘做网站仙游县网站建设
  • 淘宝联盟网站建设源码护肤品推广软文
  • 合肥专业建站松江注册公司
  • 网站建设通常用到哪些编程用手机做服务器做网站
  • 淘客网站怎么备案wordpress为何经常被黑
  • 公司网站是做的谷歌的网页制作题怎么做
  • 做网站还是小程序西安seo网站排名优化公司