我在应用程序中有一个带有TextView的布局--不是我写的。我希望将其设置为粗体或更改xml中的字体系列。在我编写的应用程序中,它工作正常。但在这一次,变化并没有显现出来。我想那是因为一个主题被应用了。如果以编程方式更改该设置,它会工作,如果以编程方式将其设置为粗体,则会正常工作。
myTextView.Typeface(Typeface.DEFAULT_BOLD)。
如何覆盖主题设置?
更新:我的布局如下:
<LinearLayout
android:id="@+id/lFiltro"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10sp"
android:layout_marginEnd="10sp"
android:orientation="horizontal"
android:visibility="gone">
<TextView
android:id="@+id/tUno"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="@font/archivo_black"
android:shadowColor="#33b5e5"
android:shadowDx="4"
android:shadowDy="4"
android:shadowRadius="5"
android:text="This is my text"
android:textAlignment="center"
android:textColor="#0000ff"
android:textSize="24sp"
android:textStyle="bold"
android:visibility="visible" />
</LinearLayout>发布于 2018-06-01 13:20:34
试着添加
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"根据您将得到的建议,对TextAppearance.之后的、TextView、、xml进行更改。
https://stackoverflow.com/questions/50643539
复制相似问题