In given code lbl[0].getTextColor() is giving Error but i don't know how to get text color of textview in java file please help me.
public void angry(View v) { if (lbl[0].getTextColor() == Color.BLACK) lbl[0].setTextColor(Color.RED); if (lbl[0].getTextColor() == Color.RED) lbl[0].setTextColor(Color.BLACK); }
Thanks.
In XML, we can set a text color by the textColor attribute, like android:textColor="#FF0000" .
TextView Text Color – To change the color of text in TextView, you can set the color in layout XML file using textColor attribute or change the color dynamically in Kotlin file using setTextColor() method.
Open your device's Settings app . Text and display. Select Color correction. Turn on Use color correction.
Use this
textView.getCurrentTextColor()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With