赞
踩
GitHub:https://github.com/AndroidKun/XTabLayout
compile 'com.androidkun:XTabLayout:1.1.3'
- <com.androidkun.xtablayout.XTabLayout
- android:id="@+id/xTablayout"
- android:layout_width="match_parent"
- android:layout_height="130px"
- app:xTabBackgroundColor="@color/white"
- app:xTabDisplayNum="2"
- app:xTabDividerColor="#eee"
- app:xTabDividerHeight="130px"
- app:xTabDividerWidth="0.5dp"
- app:xTabIndicatorColor="@color/blue"
- app:xTabIndicatorHeight="2dp"
- app:xTabMode="fixed"
- app:xTabSelectedTextColor="@color/blue"
- app:xTabSelectedTextSize="15sp"
- app:xTabTextBold="false"
- app:xTabTextColor="#000"
- app:xTabTextSelectedBold="false"
- app:xTabTextSize="14sp" />
app:xTabDisplayNum="3"
- tabLayout.setxTabDisplayNum(3);//需要写在setupWithViewPager前
- tabLayout.setupWithViewPager(viewPager);
- //将TabLayout和ViewPager关联起来。
- XTabLayout tabLayout = (XTabLayout) findViewById(R.id.xTablayout);
- tabLayout.setupWithViewPager(viewPager);
- app:xTabBackgroundColor="#fff"
- app:xTabSelectedBackgroundColor="#ff0"
- app:xTabDividerWidth="2dp"
- app:xTabDividerHeight="15dp"
- app:xTabDividerColor="#000"
- app:xTabDividerGravity="center"
- tabLayout.setDividerSize(5,20);
- tabLayout.setDividerColor(Color.BLACK);
- tabLayout.setDividerGravity(DividerDrawable.CENTER);
- <!-- 设置选中Tab的文本是否粗体显示-->
- app:xTabTextSelectedBold="true"
- <!-- 设置未选中Tab的文本是否粗体显示-->
- app:xTabTextBold="true"
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。