2011-05-05 24 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功能的預構建系統映像可用於仿真器。