7
我正在挖掘Android的來源,通過查找系統如何識別@null在佈局中提到的關鍵字的答案。例如,Android如何在佈局中解釋@null關鍵字?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@null"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
到目前爲止,我跟着這條路線:
- TypedArray#getDrawable(int index)
- ResourcesImpl#getValue(@AnyRes int id, TypedValue outValue, boolean resolveRefs)
- AssetManager#getResourceValue(@AnyRes int resId, int densityDpi, @NonNull TypedValue outValue,boolean resolveRefs)
- AssetManager#loadResourceValue(int ident, short density, TypedValue outValue,boolean resolve)
我嘗試到f ind在source code的JNI執行AssetManager loadResourceValue方法,但是我沒有成功。
如果有人能指出Android如何解析@null標記,我將不勝感激。
在此先感謝!
哇,代碼看起來很瘋狂!塞里奧,謝謝你的回覆! –