entferne ich auf die rootview
auf diese Weise AnsichtKann nicht Ansicht von Stammansicht
/* remove view from the root view start */
rootView = ((Activity) mContext).getWindow().getDecorView().findViewById(android.R.id.content);
RelativeLayout loadingTempCoverRelative =(RelativeLayout) rootView.findViewById(R.id.loadingTempCoverRelative);
if(loadingTempCoverRelative!=null){
if(rootView instanceof FrameLayout){
((FrameLayout)rootView).removeView(loadingTempCoverRelative);
}
}
/* remove view from the root view end */
von Stammansicht entfernen
private RelativeLayout addThisView;
private View rootView;
LayoutInflater inflater = LayoutInflater.from(mContext);
addThisView = (RelativeLayout) inflater.inflate(R.layout.loading_temp_cover, null, false);
if(rootView instanceof FrameLayout){
((FrameLayout)rootView).addView(addThisView);
}
versuchen, die Ansicht hinzufügen und dann, wenn ich das überprüfen loadingTempCover
ist existieren (unter Codes). es ist immer noch existent .. ich debuggte und sehe; Wenn die Funktion removeView()
erreicht und vervollständigt wird, hat das keinerlei Auswirkungen. immer noch kann ich das loadingTempCover
Layout in rootview
sehen. Ich konnte nicht verstehen, wo mache ich falsch ..
rootView = ((Activity)mContext).getWindow().getDecorView().findViewById(android.R.id.content);
RelativeLayout loadingTempCoverRelative =(RelativeLayout) rootView.findViewById(R.id.loadingTempCoverRelative);
if(loadingTempCoverRelative!=null){
loadingTempCoverRelative.setVisibility(loadingTempCoverRelative.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE);
return;
}
i das Problem verstanden. Wie kann es möglich sein, dass Android Studio dieses Problem verursacht. interessant .. Ich baue das Projekt neu und removeView funktioniert jetzt. Übrigens, ich verstehe nicht, warum Sie meine Frage als nicht nützlich markieren? das ist auch so interessant. – fthopkins