Android的FILL_PARENT到match_parent [英] Android fill_parent to match_parent
问题描述
什么是落后引入match_parent和去precating FILL_PARENT因为两者的意思是一样的原因。不会这种变化是一个障碍向后兼容?
What was the reason behind introducing match_parent and deprecating fill_parent since both mean the same thing. won't this change be a hindrance to backward compatibility?
推荐答案
使用match_parent代替FILL_PARENT不会使生成APK unrunnable,因为在生成APK旧版本match_parent的和FILL_PARENT的发生将被替换为它们对应的恒值,这是在这种情况下,相同(都-1),因此相同的APK可以运行在旧版本的Android平台以及
Using match_parent instead of fill_parent will NOT make the generated APK unrunnable in older versions because in the generated APK the occurrence of match_parent's and fill_parent's will be replaced with their corresponding Constant Value, which is same in this case (both are -1), so same APK can run on older versions of Android platform as well.
不过,在编译code。如果切换到旧版本(版本7或更低),那么你会得到一个编译错误(因为match_parent没有在版本7或定义见下文)。
But while compiling the code if you switch to older version (version 7 or below) then you will get a compilation error (since match_parent is not defined in version 7 or below).
这篇关于Android的FILL_PARENT到match_parent的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!