Gibt es eine Möglichkeit, eine Ansicht mit WindowManager mit Animation (bei androids Projekt) aufzublasen? Ich kann es nicht einmal mit den Beispielen auf den Seiten machen! Ich habe viele Beispiele benutzt, aber keiner hat funktioniert!WindowManager mit Animation (ist das möglich?)
public BannerLayout(Activity activity, final Context context) {
super(context);
this.context = context;
final WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
PixelFormat.TRANSLUCENT);
wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.popupLayout = (RelativeLayout) inflater.inflate(R.layout.popup_activity, null);
this.popupLayout.setVisibility(GONE);
this.setActive(false);
wm.addView(this.popupLayout, params);
context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
private void show(){
Animation in = AnimationUtils.loadAnimation(this.context, android.R.anim.fade_in);
this.popupLayout.setAnimation(in);
this.setActive(true);
this.popupLayout.setVisibility(VISIBLE);
}
sandrstar ... hat perfekt funktioniert! aber ... Ich frage mich, ob es möglich ist, Animationsübersetzung mit diesen Komponenten zu verwenden. Ich brauche einen Effekt auf und ab dem Bildschirm mit dieser Komponente ... – LeandroPortnoy
private void show() { \t \t \t \t // Animation, fadeIn = (Animation) AnimationUtils.loadAnimation (getContext(), android.R zu machen. anim.fade_in); \t \t //this.startAnimation (fadeIn); \t //this.bannerRelativeLayout.setVisibility (VISIBLE); \t \t \t \t this.setActive (wahr); mPopupLayout.setVisibility (SICHTBAR); \t \t final Animation in = neu TranslateAnimation (0, 0, -1000, 0); in.setDuration (700); AnimationSet Animation = new AnimationSet (false); animation.addAnimation (in); \t mPopupLayout.startAnimation (Animation); \t} – LeandroPortnoy
Sorry für die Verzögerung. Ich habe es versucht und scheint es funktioniert gut. Möglicherweise müssen Sie params.width = ViewGroup.LayoutParams.MATCH_PARENT verwenden; params.height = ViewGroup.LayoutParams.MATCH_PARENT; für FrameLayout. – sandrstar