Kewei
首页·Home
留言·Message
关于·About
搜索
chip字体设置
2018年07月23日 21:02:20
866
0
0
文章分类:
Android
## chip无法设置字体颜色等属性 最近开始接触Material Design,不得不说,Google的这个玩意真的让自己的App瞬间高端大气上档次了(简直就是不会设计的工科狗的福音) - 先送上Chip的详细介绍链接:https://material.io/design/components/chips.html Chip的种类有很多种,但是使用起来大同小异,这里以Action Chip为例 仔细看了Chip的介绍会知道Chip本身没有提供TextSize和TextColor这样的属性,那么我们如何设置chip当中字体的一些颜色呢?这里我们采用曲线救国的方法,设置Chip的textAppearance属性,在style.xml文件中创建whiteboldtext(这样一来不仅仅是颜色,常规的字体属性想怎么玩就怎么玩了) ``` <style name="WhiteBoldText"> <item name="android:text">"DONE</item> <item name="android:textSize">@dimen/shortcut_detail_text_size_normal</item> <item name="android:textColor">@color/text_white_high</item> </style> ``` 然后Chip的TextAppearance属性引用这个style ``` <android.support.design.chip.Chip android:id="@+id/button_done" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="@style/WhiteBoldText" android:backgroundTint="@color/primary_900"/> ```
点赞
0
分享