Tôi đang tìm hiểu nguồn Android bằng cách tìm kiếm câu trả lời về cách hệ thống nhận ra @null từ khóa được đề cập trong bố cục. Ví dụ,Cách Android diễn giải @null từ khóa trong bố cục?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@null"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
đến nay tôi đi theo con đường này:
- 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)
Tôi cố gắng để f ind in source code thực hiện JNI của AssetManager phương thức loadResourceValue, nhưng tôi chưa thành công.
Tôi sẽ đánh giá cao nếu có ai có thể chỉ ra cách Android giải quyết thẻ @null.
Cảm ơn trước!
Ồ, mã có vẻ điên rồ! Serio, cảm ơn bạn đã trả lời! –