Android绕过主题设置
我在应用程序中有一个带有文本视图的布局-不是我写的。我想将其设置为粗体或更改xml中的字体系列。在我编写的应用程序中,它工作正常。但在这一次,变化没有显示出来。我想那是因为应用了一个主题。如果我以编程方式更改设置,它会工作;如果我以编程方式将其设置为粗体,它会工作 myTextView.Typeface(Typeface.DEFAULT_粗体) 如何覆盖主题设置 更新: 我的布局如下:Android绕过主题设置,android,android-layout,textview,android-theme,android-styles,Android,Android Layout,Textview,Android Theme,Android Styles,我在应用程序中有一个带有文本视图的布局-不是我写的。我想将其设置为粗体或更改xml中的字体系列。在我编写的应用程序中,它工作正常。但在这一次,变化没有显示出来。我想那是因为应用了一个主题。如果我以编程方式更改设置,它会工作;如果我以编程方式将其设置为粗体,它会工作 myTextView.Typeface(Typeface.DEFAULT_粗体) 如何覆盖主题设置 更新: 我的布局如下: <LinearLayout android:id="@+id/lFiltro" andr
<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>
尝试添加
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
您是否尝试过更改
TextViewxml中的app:theme
属性?我的布局中没有“app:theme”属性,如果您开始键入“theme”,它应该是可用的在TextView
元素中。你在使用自定义字体吗?我想使用自定义字体,但它不会改变自定义字体并不总是允许使用粗体字体。