You can also tweak the flags if you want some behavior different than a default dialog (not touch modal or such). So for your code here, you can just make a Dialog, set its content to your custom content, set its gravity, width and height to the values you have here, and set its windowAnimations field to your style defining the animations. For example, the style used for the standard dialogs is: set windowEnterAnimation to the animation resource to run when the window is being shown, and windowExitAnimation to the one to run when it is hidden. This is an integer field that takes the resource id of a style resource defining the various animations associated with the window. This is more efficient than doing it inside of the window because each frame of the animation only requires re-compositing the screen with the new animation transformation, instead of re-drawing the window contents and then re-compositing it. Then the window manager will apply that animation to the entire window surface as you specify. That said, since you are using an old-style animation, there is a better way to animate full windows, the way that the system animates dialogs and activities and such: set the animation in the window's layout params. If you want to do a view animation, you should leave the root view alone (it is the anchor of the window) and animate the elements inside of it. It is what drives the layout of its child windows. The root view is somewhat special - it defines the top-most part of the window, exactly matches the window, and is always forced to be the size of the window. I think the main problem you have here is that you are trying to animate the root view of the window. It will take care of all the details of working with the window manager, and doesn't limit you in any way with how you can animate it. In fact, I would urge you to just use Dialog for this and set its attached window to be what you want. If you want a window layered on top of your main window, you should be using TYPE_APPLICATION. Now, first, what in the world are doing using TYPE_PHONE? You don't want to do that. The format is PixelFormat.RGBA_8888 (and I would strongly recommend using PixelFormat.TRANSLUCENT instead). _NOT_TOUCH_MODAL|_NOT_FOCUSABLE (seriously, written in decimal as well?). The name of the window manager service is Context.WINDOW_SERVICE. Top_line.startAnimation(animShowTopLine) įirst, please for your own sanity don't hard-code a bunch of constants like that. WmParams =new WindowManager.LayoutParams() Wm =(WindowManager) getApplicationContext().getSystemService("window") Top_line = (LinearLayout) inflate.inflate(R.layout.line, null) LayoutInflater inflate = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE) Animation animShowTopLine ĪnimShowTopLine = AnimationUtils.loadAnimation(this, R.anslate) If anyone has any idea how to animate windowmanager I ll be appreciate. But for now I want this menu to animate but it seems animation takes no effect. it was about UI issues I encountered why I choise windowmanager to do such a menu. I have an activity and I wanted to show a sort of menu at the top of the screen and I used windowmanager to handle this. First of all thanks everyone who tries to reply this topic.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |