0

I have a TextView like this , in my fragment I set theme for it but I don't want textcolor in TextView change. Any help that I appreciate it.

<TextView
                android:id="@+id/txt_label1"
                android:text="@string/new_release_hit_films"
                android:textSize="18sp"
                android:textStyle="bold"
                android:textColor="@color/black"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"/> 

In my fragment I set :

requireContext().getTheme().applyStyle(R.style.GreenColor, true);

And my style :

<style name="GreenColor">
        <item name="android:textColor">@color/green</item>
        <item name="android:background">@color/green</item>
</style>
  • You are changing the Fragment's theme. See this post how to change TextView's appearance at runtime: https://stackoverflow.com/questions/4630440/how-to-change-a-textviews-style-at-runtime – Tam Huynh Nov 12 '21 at 15:41

0 Answers0