findViewById(R.id.content)和getRootView()之间的区别是什么?不要都返回一个活动的根本看法?
What is the difference between findViewById(R.id.content) and getRootView() ? Don't both return the root view of an activity?
该方法的 findViewById(R.id.content)
向下搜索视图层次了ID为内容的查看
(它检查自己以及)。
The method findViewById(R.id.content)
searches down the view hierarchy for a View with the id content
(it examines itself as well).
该方法 getRootView( )
走了视图层次,直到达到根视图(它会检查自己以及)。
The method getRootView()
walks up view hierarchy until it hits the root View (it examines itself as well).
如果您在查看具有ID 内容
,它是根视图,那么这些方法会产生相同的结果,否则他们不会。
If the View you are in has the id content
and it is the root view then these methods will give the same result, otherwise they won't.
上一篇:番石榴:java.lang.NoClassDefFoundError的 - com.google.common.collect.HashBiMap番石榴、lang、NoClassDefFoundEr