I need to know what actual difference between TextView and TextViewCompat. When we should use TextViewCompat?
A TextView which supports compatible features on older versions of the platform, including: Allows dynamic tint of its background via the background tint methods in ViewCompat . Allows setting of the background tint using R.
AppCompatTextView use to provide backwards compatibility for new functions to older versions of Android. thois is not a problem, you can extend whatever you want. Android Studio only warns you that AppCompatTextView is more suitable to be used for compatibility.
In much the same way as other compatibility classes, it exists to provide backwards compatibility for new functions to older versions of Android.
If you compare the two, you will see the difference.
One such example is getMaxLines(). In an ordinary TextView
, this requires SDK level 16. TextViewCompat
introduces such functions for SDK levels from 4.
define TextViewCompat in developer.android
A TextView which supports compatible features on older version of the platform, including:
Supports textAllCaps style attribute which works back to Gingerbread. Allows dynamic tint of it background via the background tint methods in ViewCompat. Allows setting of the background tint using backgroundTint and backgroundTintMode.
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