Android 设置TabLayout背景和字体大小
来源:互联网 发布:广告宣传单制作软件 编辑:程序博客网 时间:2024/05/29 07:32
效果图:
TabLayout使用如下:
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.design.widget.TabLayout android:id="@+id/tab_layout" android:layout_width="match_parent" android:layout_height="@dimen/tablayout_height" app:tabBackground="@drawable/tablayout_background" app:tabIndicatorHeight="0dp" app:tabSelectedTextColor="@color/white" app:tabTextAppearance="@style/TabLayoutTextStyle" app:tabTextColor="@color/white" /> <View android:id="@+id/view_pager_line" android:layout_width="match_parent" android:layout_height="1px" android:background="@color/divider_color" /> <android.support.v4.view.ViewPager android:id="@+id/viewpager" android:layout_width="match_parent" android:layout_height="match_parent"/></LinearLayout>
其中app:tabBackground=”@drawable/tablayout_background”中为自定义selector,代码如下:
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/tab_horizontal_item_p" android:state_selected="true" /> <item android:drawable="@drawable/tab_horizontal_item_d" /></selector>
app:tabTextAppearance=”@style/TabLayoutTextStyle”为自定义style:
<style name="TabLayoutTextStyle"> <item name="android:textSize">@dimen/text_16_sp</item></style>
如果去掉TabLayout 自带 滚动条,可是如下配置:
app:tabIndicatorHeight="0dp"
原文:http://blog.csdn.net/ming2316780/article/details/51763864 本文略有改动。
0 1
- Android 设置TabLayout背景和字体大小
- Android中TabLayout切换选项背景和修改字体大小
- Android中TabLayout切换选项背景和修改字体大小
- Android TabLayout 设置Tab 字体大小
- android studio 设置字体大小和背景
- android studio 更改背景和设置字体大小
- android studio 更改背景和设置字体大小
- android studio 更改背景和设置字体大小
- android studio 更改背景和设置字体大小
- android studio 更改背景和设置字体大小
- android studio 更改背景和设置字体大小
- android studio 更改背景和设置字体大小
- Android studio设置字体大小和更改背景
- Android Studio 更改背景和设置字体大小
- TabLayout切换选项背景和修改字体大小
- Android 中TabLayout如何设置字体大小!
- Android Studio中更改背景和设置字体大小
- Tablayout 设置字体大小
- 发布Qt应用程序(NSIS使用教程)
- 网易内推笔试合集(二)题解
- H.264 NAL层解析(0x00000001,编码,打包,NALU)
- JavaScript垃圾回收机制
- android中设置圆角控件
- Android 设置TabLayout背景和字体大小
- 几个闭包内存泄漏的优化方案!
- Java IO操作——回退流PushbackInputStream
- box-sizing属性
- 微信编辑器
- mysql 添加索引演变进程
- 利用递归解决全排列问题
- Git 少用 Pull 多用 Fetch 和 Merge
- 通知