我正在从头开始开发一个 Android 项目,该项目至少具有 23 API 级别并使用 AndroidX。当我完成 XML 布局(例如简单的 activity_layout)时,可以在 TextView
和 androidx.appcompat.widget.AppCompatTextView
之间进行选择。
TextView
是否针对 AndroidX?- 如果是,我是否可以忽略使用
androidx.appcompat.widget.AppCompatTextView
或其他AppCompat
组件(如果我的目标是最低 23 API 级别)?
最佳答案
Is TextView targeting AndroidX?
问题不清楚,但是 androidx.appcompat.widget.AppCompatTextView
类扩展了 android.widget.TextView
。
您可以查看 official doc .
A TextView which supports compatible features on older versions of the platform.
还有:
This will automatically be used when you use
TextView
in your layouts and the top-level activity / dialog is provided by appcompat. You should only need to manually use this class when writing custom views.
然后。
If yes, can I ignore using androidx.appcompat.widget.AppCompatTextView or other AppCompat component if I target min 23 API level?
如果您使用的是 androidx.appcompat:appcompat:x.y.z
库,则可以忽略此 View 。
关于android - AppCompat 是否可以在 API 23+ 上忽略?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57478346/