2011-05-05 73 views
1

我试图使用ViewDebug.startHierarchyTracing方法,但它不做任何事情,因为它检查ViewDebug.TRACE_HIERARCHY,如果它是false,则立即返回。 其实这是根据JavaDoc预期的行为:如何使用android.view.ViewDebug静态方法?

如果TRACE_HIERARCHY为false,此方法将立即返回。

的问题是,TRACE_HIERARCHY在源声明为与false的值的布尔常数:

/** 
* Enables or disables view hierarchy tracing. Any invoker of 
* {@link #trace(View, android.view.ViewDebug.HierarchyTraceType)} should first 
* check that this value is set to true as not to affect performance. 
*/ 
public static final boolean TRACE_HIERARCHY = false; 

另外还有startRecyclerTracingstartMotionEventTracing方法依赖于TRACE_RECYCLER(从公共API隐藏)和TRACE_MOTION_EVENTS常量(它们也被设置为false)。

所以我想知道是否可以使用ViewDebug类,或者它只打算用于定制的Android构建?如果是这样的话,那么可以使用Emulator的这种定制(调试?)构建?

回答

1

基于this Dianne Hackborn评论我可以假设ViewDebug仅适用于自定义Android版本(具有ViewDebug常量的修改值)。然而,似乎没有使用ViewDebug功能的预构建系统映像可用于仿真器。