appCompat v7中的LinearLayoutCompat是什么? [英] What is LinearLayoutCompat in appCompat v7?
问题描述
在Android平台的支持库appCompat v7中,有一个 android.support.v7.widget.LinearLayoutCompat 类.
In the support library appCompat v7 of the Android platform, there is a android.support.v7.widget.LinearLayoutCompat class.
有人知道为什么存在此类吗?最初的LinearLayout类自API级别1起就存在,因此我不明白为什么会有兼容版本.
Does someone know why this class exist? The original LinearLayout class exist since API level 1 so I don't understand why there is a compat version.
推荐答案
自API级别1开始存在类 LinearLayout
,但此后又添加了一些API,例如 setShowDividers 在API级别11上引入了code>.
The class LinearLayout
exists since API level 1, but some APIs were added after that, for example, setShowDividers
introduced on API level 11.
因此,在这种情况下,如果您要针对具有API级别的平台,则应使用 LinearLayoutCompat
而不是 LinearLayout
调用 setShowDividers
(及其参数)低于11.
So in this case setShowDividers
(and it's parameters) should be invoked using LinearLayoutCompat
instead LinearLayout
if you are targeting a platform with API level below 11.
这篇关于appCompat v7中的LinearLayoutCompat是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!