This is sample code, i need to change text color in text view for certain condition. like, for different months text color should different . Thank you.
FragmentOne.kt
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
class FragmentOne : Fragment() {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_one, container, false)
}
}
fragment_one.xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".FragmentOne">
<TextView
android:id="@+id/textview"
android:textAlignment="center"
android:layout_gravity="center"
android:background="#7654ad"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="me !" />
</FrameLayout>