Ashish Dwivedi
Ashish Dwivedi

Reputation: 8196

What is the difference between TextView and TextViewCompat

I need to know what actual difference between TextView and TextViewCompat. When we should use TextViewCompat?

Upvotes: 23

Views: 19764

Answers (2)

Mahdi Mortazavi
Mahdi Mortazavi

Reputation: 69

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.

Upvotes: 0

Knossos
Knossos

Reputation: 16058

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.

Upvotes: 20

Related Questions