Tablayout简单使用方法总结

时间:2021-05-20

本文为大家分享了Tablayout简单的使用方法,供大家参考,具体内容如下

一、TabLayout普通用法

在项目中使用viewpager的时候大多数都是和TabPagerIndicator结合使用,TabPagerIndicator是第三方的,使用起来比较繁琐;

2015谷歌大会官方发布了TabLayout,可以很简单很完美的实现这种效果;

因为是官方发布的,所以使用起来不用任何第三方的东西;而且非常简单明了;

同样,如果想要使用Tablayout必须在build中配置:

dependencies { compile 'com.android.support:design:23.1.1' }

先看下布局:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="pat.getDrawable(this, R.drawable.layout_divider_vertical)); linearLayout.setDividerPadding(15);

点击打开链接免费下载源码

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章