Có cách nào để tăng lượt xem bằng WindowManager bằng Animation (ở dự án của android) không? Tôi chỉ không thể làm điều đó ngay cả khi sử dụng các ví dụ trong các trang web! Tôi đã sử dụng nhiều ví dụ nhưng không có tác dụng nào!WindowManager with Animation (có thể không?)
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 ... hoạt động hoàn hảo! Tuy nhiên ... Tôi tự hỏi nếu nó có thể sử dụng dịch hình ảnh động với các thành phần này. Tôi cần phải thực hiện một hiệu ứng lên xuống màn hình với các thành phần này ... – LeandroPortnoy
private void show() { \t \t \t \t // Animation fadeIn = (Animation) AnimationUtils.loadAnimation (getContext(), android.R. anim.fade_in); \t \t //this.startAnimation(fadeIn); \t //this.bannerRelativeLayout.setVisibility(VISIBLE); \t \t \t \t this.setActive (true); mPopupLayout.setVisibility (VISIBLE); \t \t Hoạt ảnh cuối cùng trong = new TranslateAnimation (0, 0, -1000, 0); in.setDuration (700); AnimationSet animation = new AnimationSet (false); animation.addAnimation (in); \t mPopupLayout.startAnimation (hoạt ảnh); \t} – LeandroPortnoy
Xin lỗi vì sự chậm trễ. Tôi đã thử nó và có vẻ nó hoạt động tốt. Có thể bạn cần sử dụng params.width = ViewGroup.LayoutParams.MATCH_PARENT; params.height = ViewGroup.LayoutParams.MATCH_PARENT; cho FrameLayout. – sandrstar