本文为大家分享了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);点击打开链接免费下载源码
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。