状态栏中的动画,如邮箱应用程序

时间:2014-05-22 17:09:50

标签: android android-animation

任何想法如何在状态栏中实现动画,如邮箱应用程序?

Mailbox screen

Link to the app

我最好奇的是淡入淡出&淡出动画,列表可以在其中滚动。

任何帮助表示赞赏。提前谢谢。

1 个答案:

答案 0 :(得分:0)

这适用于android 4.4.4和5.0。

 WindowManager windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);

        int statusBarHeight = (int) Math.ceil(25 * getResources().getDisplayMetrics().density);

        TextView textView = new TextView(this);
        textView.setText("I am on top of status bar");
        textView.setBackgroundColor(Color.BLACK);
        textView.setGravity(Gravity.CENTER);

        WindowManager.LayoutParams params = new WindowManager.LayoutParams(
                WindowManager.LayoutParams.FILL_PARENT,
                statusBarHeight,
                WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
                WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|
                        WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL|
                        WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
                PixelFormat.TRANSLUCENT);

        params.gravity = Gravity.TOP | Gravity.RIGHT;

        windowManager.addView(textView, params);