TabLayout属性介绍
来源:互联网 发布:好看的仙侠言情文 知乎 编辑:程序博客网 时间:2024/06/06 01:47
1.什么是TabLayout
TabLayout提供了一个水平的布局用来展示Tabs。
使用时直接引用design库
compile 'com.android.support:design:25.1.0'
在清单文件中设置如下代码即可:
android:theme="@style/Theme.AppCompat"
2.TabLayout的基本使用方式
在布局中加入该控件:
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
2.在代码中
tabLayout= (TabLayout) findViewById(R.id.tabLayout);
tabLayout.addTab(tabLayout.newTab().setText("Tab 1"));
tabLayout.addTab(tabLayout.newTab().setText("Tab 2"));
tabLayout.addTab(tabLayout.newTab().setText("Tab 3"));
3.改变TabLayout的颜色
1.改变选中字体的颜色
app:tabSelectedTextColor=""
2.改变未选中字体的颜色
app:tabTextColor=""
3.改变指示器下标的颜色
app:tabIndicatorColor=""
4.改变整个TabLayout的颜色
app:tabBackground="color"
4.改变TabLayout内部字体大小
app:tabTextAppearance="@android:style/TextAppearance.Holo.Large"
5.改变指示器下标的高度
app:tabIndicatorHeight=""
6.添加图标
tabLayout.addTab(tabLayout.newTab().setText("Tab 1").setIcon(R.mipmap.ic_launcher));
// ......
TabLayout提供了一个水平的布局用来展示Tabs。
使用时直接引用design库
compile 'com.android.support:design:25.1.0'
在清单文件中设置如下代码即可:
android:theme="@style/Theme.AppCompat"
2.TabLayout的基本使用方式
在布局中加入该控件:
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
2.在代码中
tabLayout= (TabLayout) findViewById(R.id.tabLayout);
tabLayout.addTab(tabLayout.newTab().setText("Tab 1"));
tabLayout.addTab(tabLayout.newTab().setText("Tab 2"));
tabLayout.addTab(tabLayout.newTab().setText("Tab 3"));
3.改变TabLayout的颜色
1.改变选中字体的颜色
app:tabSelectedTextColor=""
2.改变未选中字体的颜色
app:tabTextColor=""
3.改变指示器下标的颜色
app:tabIndicatorColor=""
4.改变整个TabLayout的颜色
app:tabBackground="color"
4.改变TabLayout内部字体大小
app:tabTextAppearance="@android:style/TextAppearance.Holo.Large"
5.改变指示器下标的高度
app:tabIndicatorHeight=""
6.添加图标
tabLayout.addTab(tabLayout.newTab().setText("Tab 1").setIcon(R.mipmap.ic_launcher));
// ......
0 0
- TabLayout属性介绍
- tablayout 属性详细介绍
- TabLayout属性的学习
- TabLayout属性详解
- TabLayout属性详解
- TabLayout属性详解
- TabLayout属性详解
- TabLayout属性详解
- TabLayout的属性
- Design库-TabLayout属性详解
- Design库-TabLayout属性详解
- Design库-TabLayout属性详解
- Tablayout简单属性及使用
- Design库-TabLayout属性详解
- Design库-TabLayout属性详解
- Design库-TabLayout属性详解
- Design库-TabLayout属性详解
- Design库-TabLayout属性详解
- 生物信息学习——bowtie2使用手册
- (二)CentOS7配置IP
- sqlserver 查看死锁和运行进程
- CSS3曲线阴影与翘角阴影
- Android知识点汇总
- TabLayout属性介绍
- Raft算法总结
- 使用beanUtils操纵javabean
- Codeforces 257C View Angle 几何(角度)
- Android Intent 用法全面总结及实例代码
- gradle build running 很久及优化
- Ex1:图像读取和显示以及像素操作
- C# 读取.resx资源文件内字符串的方法
- leetcode题解-274. H-Index