Im new to android and i have been trying to find out an answer to this. I have a layout file .xml for listview that has two textviews, one is for heading with a greater size and other below it for description. What i want is that heading textview's text stays white and description textview's text stays grey in my current theme. That is dark theme. But user has the option to change the theme, so when user selects Light theme i want my heading textview's text (that is within layout that i have for listview's rows) to become black and also the description textview's text to become black.
Please help and thanks in advance.
You can change theme programmatically. There is one guy asked this hours ago. Can you check this : how-to-change-colour-when-user-wants-another-colour-in-the-app
Also if you want to use diferent themes for different
TextViews you can try like :
How i can create custom themes for TextView
styles.xml create different styles :
<style name="MyBlueTextTheme" parent="@android:style/TextAppearance.Medium"> <item name="android:textSize">18sp</item> <item name="android:textColor">#123456</item> <item name="android:textStyle">bold</item> </style>
Then use it like :
<TextView android:id="@+id/textBlue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" style="@style/MyBlueTextTheme" android:text="This is a blue styled text" />