Android 泽宇三种底部导航栏
compile 'com.flyco.tablayout:FlycoTabLayout_Lib:2.0.8@aar'//底部导航
<com.flyco.tablayout.CommonTabLayout android:layout_height="100dp"
android:layout_width="match_parent"
android:id="@+id/tab_layout"
android:padding="5dp"
android:layout_alignParentBottom="true"/>
private String[] mTitles = {"首页", "美女", "视频", "关注"};
private int[] mIconUnselectIds = {
R.mipmap.ic_home_normal, R.mipmap.ic_girl_normal, R.mipmap.ic_video_normal, R.mipmap.ic_care_normal};
private int[] mIconSelectIds = {
R.mipmap.ic_home_selected, R.mipmap.ic_girl_selected, R.mipmap.ic_video_selected, R.mipmap.ic_care_selected};
private ArrayList<CustomTabEntity> mTabEntities = new ArrayList<>();
private int measuredHeight;
//屏幕适配
tab_layout.measure(0,0);
measuredHeight = tab_layout.getMeasuredHeight();
initTab();
for (int i = 0; i < mTitles.length; i++) {
mTabEntities.add(new TabEntity(mTitles[i],mIconSelectIds[i],mIconUnselectIds[i]));
}
tab_layout.setTabData(mTabEntities);
implementation 'com.hjm:BottomTabBar:1.2.2'//底部导航
buttomTab的方法
bottom.init(getSupportFragmentManager())
.setImgSize(30, 30)
.setFontSize(10)
.setChangeColor(Color.RED, Color.DKGRAY)
.addTabItem("首页",R.mipmap.ic_home_selected,R.mipmap.ic_home_normal, HomeFragment.class)
.addTabItem("美女", R.mipmap.ic_girl_selected, R.mipmap.ic_girl_normal, GirlFragment.class)
.addTabItem("视频", R.mipmap.ic_video_selected, R.mipmap.ic_video_normal, VieoFragment.class)
.addTabItem("关注", R.mipmap.ic_care_selected,R.mipmap.ic_care_normal, GuanFragment.class)
.isShowDivider(false);
//JPTabBar 的github网址
https://github.com/peng8350/JPTabBar
implementation 'com.jpeng:JPTabBar:1.2.3'
如果想在中间设置图片突起的话,父布局必须得是相对布局和,帧布局,它的高度得定死
<com.jpeng.jptabbar.JPTabBar
android:id="@+id/tabBar"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
app:TabIconSize="20dp"
app:TabMiddleView="@layout/item" />
java代码,利用反射注解
@Titles
private static final String[] mTitles = {"页面一", "页面二", "页面三", "页面四"};
@SeleIcons
private static final int[] mSeleIcons = {R.mipmap.a, R.mipmap.b, R.mipmap.c, R.mipmap.d};
@NorIcons
private static final int[] mNormalIcons = {R.mipmap.aa, R.mipmap.bb, R.mipmap.cc, R.mipmap.dd};
//获取中间图片的id
View middleView = tabBar.getMiddleView();
ImageView imageView = middleView.findViewById(R.id.img);
//关联viewPager
tabBar.setContainer(viewPager);
Android 泽宇三种底部导航栏相关推荐
- android自定义底部中间突出导航栏,Android选中突出背景效果的底部导航栏功能
今天在群里看到一个底部导航选中突出效果像这样 就想着 这个应该怎么做呢,我记得类似咸鱼那种的是中间突出,不像这种 是选中哪个,哪个就突出 第一种方法 简单快捷,让UI帮忙切几张带突出背景的图片, 选中 ...
- 微信小程序从零开始开发步骤(三)底部导航栏
上一章节,我们分享了如何创建一个新的页面和设置页面的标题,这一章我们来聊聊底部导航栏是如何实现的.即点击底部的导航,会实现不同对应页面之间的切换. 我们先来看个我们要实现的底部导航栏的效果图:(三个导 ...
- Android 最常用的四种底部导航栏实现
Android 底部导航栏实现 底部导航栏的应用非常的广泛.今天就总结下几种实现的方式. 一.Fragment + TextView 实现 前面一篇博客在介绍Fragment 的时候就使用了Fragm ...
- Android Navigation与BottomNavigationView实现底部导航栏
底部导航栏 一.效果图 二.实现 1.创建Fragment以及布局文件 2.添加FragmentContainerView和BottomNavigationView两个控件 3.配置xml资源文件 4 ...
- android radiobutton底部导航,android中Fragment+RadioButton实现底部导航栏
在App中经常看到这样的tab底部导航栏 那么这种效果是如何实现,实现的方式有很多种,最常见的就是使用Fragment+RadioButton去实现.下面我们来写一个例子 首先我们先在activity ...
- android开发时华为手机底部导航栏挡住了应用布局
原因:使用安卓的BottomNavigationView控件开发底部导航栏同时使用了沉浸式状态栏导致华为手机的底部导航栏会盖住我应用的导航栏. 解决:先写一个工具类 import android.co ...
- android获取刘海屏状态栏高度,Android刘海屏全面屏底部导航栏的适配
关于Android状态栏和虚拟导航栏的适配,文章:https://blog.csdn.net/leogentleman/article/details/54566319 讲的很不错. 状态栏的适配: ...
- android底部导航栏选中动画,Android选中突出背景效果的底部导航栏功能
今天在群里看到一个底部导航选中突出效果像这样 就想着 这个应该怎么做呢,我记得类似咸鱼那种的是中间突出,不像这种 是选中哪个,哪个就突出 第一种方法 简单快捷,让UI帮忙切几张带突出背景的图片, 选中 ...
- 在android Studio中设计app的底部导航栏
准备工作 新建一个空白android项目 命名为csdn 在res/layout路径下设置主页面 使用线性布局 linearLayout 使用自定义的viewPager(切换多个页面会秒跳转,提升体验 ...
最新文章
- Jenkins 2.16.3默认没有Launch agent via Java Web Start,如何配置使用
- RxJava使用(一)基本使用
- 一周一论文(翻译)——[SIGMOD 2015] TIMELY RTT-based Congestion Control for the Datacenter
- leetcode 202. Happy Number
- 扩展WCF的消息分发行为
- iPhone11系列新配色售空 暗夜绿溢价超过500元
- 微课|中学生可以这样学Python(5.8.2节):使用切片修改列表
- 参数等效模型可以用于_华北电力大学 陈宁、齐磊 等:适用于柔性直流电网操作过电压分析的混合式高压直流断路器端口等效模型...
- Bad owner or permissions on .ssh/config win10问题解决
- PostgreSQL eighth class
- IntelliJ IDEA 激活 破解补丁
- rem移动端设计方案
- JavaSrcipt学习(学习打卡Day6)
- Pytorch:一、对图片数据进行标准化(猫狗)
- win10计算机系统慢,电脑win10系统为什么反应那么慢,原来出在这里
- SVN 如何解决冲突?
- 【2023电赛备赛】使用sysconfig对ccs进行图形化编程
- Oracle-OGG trail 文件大小引起的进程异常 OGG-01172
- win7计算机无法连接投影仪,win7系统下投影仪无法输出信号到电脑的解决方法
- SVGA 礼物动画设计相关