Skip to content

简易的TabLayout,可单独使用或ViewPager联动

Notifications You must be signed in to change notification settings

iDan1230/TabLayout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

abc7861 · Jul 27, 2017

History

12 Commits
Jul 24, 2017
Jul 27, 2017
Jul 24, 2017
Jul 27, 2017
Jul 24, 2017
Jul 27, 2017
Jul 24, 2017
Jul 24, 2017
Jul 24, 2017
Jul 24, 2017
Jul 24, 2017

Repository files navigation

TabLayout

一、效果图

1.初始位置

image

2.

image

3.居中

image

4.

image

二、用法 xml中

   
<tab.tablayout.TabLayout
android:id="@+id/tablayout"
android:layout_width="360dp"
android:layout_height="wrap_content"
       tab:label_count="4" // 显示title数量
       tab:label_size="4dp" // 线条的高度
       tab:label_text_color="@color/c_main" //选中时的颜色
       tab:label_text_size="16sp"//字体大小,必须是sp
       tab:unsele_text_color="@color/colorPrimary"//未选中时的颜色
       tab:view_height="50dp"//空间真实的高度
       tab:view_width="360dp"/>//控件真实的宽度,必须和layout_width一致
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>

三、用法 代码中

       List stringList = new ArrayList<>();
      tablayout.setLabelTitles(stringList);
       如果想要和ViewPager联动就加上下面两句
       pager.setAdapter(new myPagerAdapter(stringList));
tablayout.setPager(pager);

About

简易的TabLayout,可单独使用或ViewPager联动

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages