简体   繁体   English

TextView和TextViewCompat有什么区别

[英]What is the difference between TextView and TextViewCompat

I need to know what actual difference between TextView and TextViewCompat . 我需要知道TextView和TextViewCompat之间的实际区别。 When we should use TextViewCompat ? 什么时候应该使用TextViewCompat

In much the same way as other compatibility classes, it exists to provide backwards compatibility for new functions to older versions of Android. 与其他兼容性类的方式大致相同,它可以为旧版Android的新功能提供向后兼容性。

If you compare the two, you will see the difference. 如果你比较两者,你会看到差异。

One such example is getMaxLines() . 一个这样的例子是getMaxLines() In an ordinary TextView , this requires SDK level 16. TextViewCompat introduces such functions for SDK levels from 4. 在普通的TextView ,这需要SDK级别16. TextViewCompat为4级SDK级别引入了这样的功能。

define TextViewCompat in developer.android 在developer.android中定义TextViewCompat

A TextView which supports compatible features on older version of the platform, including: TextView支持旧版平台上的兼容功能,包括:

Supports textAllCaps style attribute which works back to Gingerbread . 支持textAllCaps样式属性,可以回溯到Gingerbread Allows dynamic tint of it background via the background tint methods in ViewCompat. 允许通过ViewCompat中的背景色调方法对其进行动态着色。 Allows setting of the background tint using backgroundTint and backgroundTintMode . 允许使用backgroundTintbackgroundTintMode设置背景色调。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM