Layout Inflater 에 대해 서
이 블 로 그 를 다 쓴 후에 아주 좋 은 것 을 보 았 습 니 다. 이것 은 링크 입 니 다. http://blog.csdn.net/guolin_blog/article/details/12921889 이 블 로그 들 은 나 로 하여 금 꽤 많은 수익 을 얻 게 한다.
@Nullable
public View findViewById(@IdRes int id) {
return getWindow().findViewById(id);
}
@Nullable
public View findViewById(@IdRes int id) {
return getDecorView().findViewById(id);
}
@Nullable
public final View findViewById(@IdRes int id) {
if (id < 0) {
return null;
}
return findViewTraversal(id);
}
protected View findViewTraversal(@IdRes int id) {
if (id == mID) {
return this;
}
return null;
}
window, view, xml id id ( ... , )
, LayoutInflater ~ , high ~
: from service
public static LayoutInflater from(Context context) {
LayoutInflater LayoutInflater =
(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (LayoutInflater == null) {
throw new AssertionError("LayoutInflater not found.");
}
return LayoutInflater;
}
LayoutInflater , :
public View inflate(@LayoutRes int resource, @Nullable ViewGroup root, boolean attachToRoot) {
final Resources res = getContext().getResources();
if (DEBUG) {
Log.d(TAG, "INFLATING from resource: \"" + res.getResourceName(resource) + "\" ("
+ Integer.toHexString(resource) + ")");
}
final XmlResourceParser parser = res.getLayout(resource);
try {
return inflate(parser, root, attachToRoot);
} finally {
parser.close();
}
}
debug , , XmlResourceParser , xml view , , xml, xml, , , view , ? ? Mainactivity OncreateView, ? =。= dispatch fragment , Oncreate, setContentView() layout, , resources , ~ , layout ~~
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.