TextView粗体通过xml文件?

use*_*701 170 resources android textview

有没有办法通过XML在TextView中加粗文本?

<TextView
   android:textSize="12dip"
   android:textAppearance="bold"  -> ??
</TextView>
Run Code Online (Sandbox Code Playgroud)

谢谢

Pas*_*TIN 459

我有一个项目,我有以下内容TextView:

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textStyle="bold"
    android:text="@string/app_name"
    android:layout_gravity="center" 
/>
Run Code Online (Sandbox Code Playgroud)

所以,我猜你需要使用 android:textStyle


Ngu*_*inh 26

只是用

android:textStyle="bold"
Run Code Online (Sandbox Code Playgroud)


Elt*_*sta 7

例:

使用: android:textStyle="bold"

 <TextView
    android:id="@+id/txtVelocidade"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_above="@+id/txtlatitude"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="34dp"
    android:textStyle="bold"
    android:text="Aguardando GPS"
    android:textAppearance="?android:attr/textAppearanceLarge" />
Run Code Online (Sandbox Code Playgroud)


Tho*_*iel 6

使用android:textStyle="bold"

Android TextView 粗体显示的 4 种方法

像这样

<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textSize="12dip"
android:textStyle="bold"
/>
Run Code Online (Sandbox Code Playgroud)

有很多方法可以让 Android TextView 变成粗体。