android系统自带textAppearance

xml布局里面设置文字的外观:

如“android:textAppearance=“?android:attr/textAppearanceLargeInverse”这里引用的是系统自带的一个外观,

?表示系统是否有这种外观,否则使用默认的外观。

可设置的值如下:

textAppearanceButton/  

 

textAppearanceInverse/  

 

 

textAppearanceLarge/  

 

textAppearanceLargeInverse/ 


textAppearanceMedium/    

 

textAppearanceSmallInverse/ 

 

textAppearanceMediumInverse/ 
 
textAppearanceSmall/  
 
代码中加下划线
textView.getPaint().setFlags(Paint. UNDERLINE_TEXT_FLAG ); //下划线
textView.getPaint().setAntiAlias(true);//抗锯齿
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Android 中,`android:textAppearance` 是一个用来定义 TextView 文字样式的属性。它可以让你快速地为一个 TextView 设置文字大小、文字颜色、字体样式等等。通过这个属性,你可以使用一个预定义的样式或者自定义一个样式来设置 TextView 的外观。 `android:textAppearance` 属性可以用于任何 TextView 子类,如 Button、EditTextTextView 等。你可以在 XML直接使用这个属性,也可以在 Java 代码中使用 `setTextAppearance()` 方法来设置。 使用 `android:textAppearance` 属性的示例: ```xml <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textAppearance="@style/MyTextAppearance" /> ``` 在上面的示例中,我们为 TextView 设置了 `android:textAppearance` 属性,并将其值设置为 `@style/MyTextAppearance`,这个样式定义了 TextView 的文字大小、文字颜色和字体样式等。 你也可以在 styles.xml 文件中定义自己的样式,如: ```xml <style name="MyTextAppearance"> <item name="android:textSize">20sp</item> <item name="android:textColor">#000000</item> <item name="android:textStyle">bold</item> </style> ``` 在上面的示例中,我们定义了一个名为 `MyTextAppearance` 的样式,设置了文字大小、文字颜色和字体样式等属性。你可以根据自己的需要自定义不同的样式,然后在 XML 中使用它们来设置 TextView 的外观。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值