I'm making a game for 2 players, this is a mockup, the problem is with the sliding drawer on top - purple one. The "handle" button must be exactly the opposite to blue handle below. How do I reverse it?
If the top purple drawer is a RelativeLayout, just set in the button the ALIGN_PARENT_TOP to true. If the drawer is not a RelativeLayout, declare one RelativeLayout(which fills all the purple drawer) inside it and put in it the button with ALIGN_PARENT_TOP to true.
Then, for having the text in the button upside down, just add android:rotation="180" to the button in your XML file or give the button a 180 degree rotation programatically.
Related
First see the below screenshot and focus on the hamburger icon only so that you will get quick idea what I really want .?
First of all I have successfully implemented the Navigation View(Drawer) to the both side left and right
So that user can open the two drawer from left & right both.
Now My question is I want hamburger icon with animation to both side.
I have implemented hamburger icon to the left side of toolbar which is easy and which comes by default.
but now I want it to right side also with arrow animation.
Click on left hamburger icon open left drawer. (done)
click on right hamburger icon open drawer from right side. (it's remaining)
So Is it possible to have two hamburger icon on a single toolbar?
Note: Both drawer are opening with gestures. and I don't have issue with it.
I think you can do it using FrameLayout.
Now Consider the following layout
<FrameLayout>
<Toolbar />
<Toolbar layout_direction="right" />
</FrameLayout>
Using this the both toolbar will appear on top of each other.
Put drawer icon to both toolbar and the second toolbar will render it right side because we have specified layout direction to right.
Note : Make the upper toolbar transparent.
I hope it help you.
I believe SlidingMenu library is what you looking for. It has LEFT and RIGHT modes.
You can write animation which translates your right icon like this
While opening drawer from x to x-someDelta
and while closing drawer
from x-somedelta to x
EDIT:
You may use ObjectAnimator and its super class Value Animator
you can do something like this
ObjectAnimator anim = ObjectAnimator.ofFloat(rightIcon, "translationX", 0,50);
anim.start();
Use a boolean value and toggle it with 50,0 in the object animator to slide back
Also you can use setDuration method to set how long the animation should take to complete
I have implemented Google's navigation drawer and I would like to add a custom animation when I click a menu item.
Ideally the menu would slide back as if closing, leaving a small sliver of the menu open. A dialog would open with an animation, originating from the space beside the selected menu item.
Something like this..
I tried to animate the left_drawer element on the x axis using ObjectAnimator, but this displaces the whole screen.
Can anyone help?
If you want it so the drawer is only peaking, try using drawerLayout.closeDrawers(true).
According to the source though, this closes all drawers (if you have more then one).
DrawLayout source
I'm using the SlidingPaneLayout and want to set gray fade color on left pane when the slider right pane is open and a transparent fade color on the left pane when the right pane is closed and left pane is fully visible.
I know this is the default behaviour of the SlidingPaneLayout , but with default implementation I'm facing issues in the landscape mode wherein my slider left pane always remains faded and takes no click events even if right slide is closed.
I implemented the SlidingPaneLayout.SimplePanelSlideListener and managed the fade colors in onPanelOpened() and onPanelClosed()
But I'm nit sure which function should I use for this... setCoveredFadeColor() or setSliderFadeColor()?
What is the exact difference between these 2 functions?
Any help is much appreciated. Thanks!
From the docs:
setSliderFadeColor(int color) Set the color used to fade the pane covered by the sliding pane out when the pane will become fully covered in the closed state.
setCoveredFadeColor(int color) Set the color used to fade the sliding pane out when it is slid most of the way offscreen.
In my experience, I've found that the panel that gets covered needs to be at least 320dp wide for these two fade colours to work.
I have a SlidingDrawer menu in my app, and when the drawer is open I want the name for each button on the drawer to display as the buttons go pass it.
Do you all have any ideas to whether this is possible or not? I have been searching for about an hour and I can't find any answers.
Assuming I understood what you want correctly (adding text from the drawer on top of buttons on the main layout) you can try this. I don't know how accurate it would be:
Place the sliding drawer as the topmost element in your layout with a transparent background.
Use exactly the same layout you're using for your "main" layout (where the buttons are) and use a textView where your buttons are.
When your sliding drawer opens, the text from its content will appear on top of the button
I am working with the android Sliding Drawer and have it working more or less. However, I am running into one problem.
I want it to slide from the right to left which works fine (set orientation to horizontal). However, the handle for the sliding drawer is at the center right of the screen. Is there anyway I can position it at the top right hand corner of the screen? Perhaps with a padding fo 20dp at the top?
There is a SlidingDrawer 'android:topOffset' property. However, this does not seem to do anything irrespective of whether I put the property on the slidingDrawer tag itself or on the handle (ImageView) tag.
Any advice or suggestions would be greatly appreciated.