There is slidingPaneLayout, which I need to keep opened.
First I tried to don use panelsidelistener, but it didn't work
Then I tried to set spl.openPane() that is also failed because it opened for some percents and opened again.
So I need to know how to keep it opened and deny slide it via touch?
Similar Posts Found But I Didn't Solve my problem. Sliding menu used in Activity class.
Related
I am creating android apps by self learning. I have tried searching for this everywhere but have not found it.
My exact question is how do I create the layout shown below. I want the Activity2 to slide up and down with up and down swipes respectively.
You can use BottomSheet to perform this.
I developed two menu like in Facebook app.
One of them contains expandableListView.
UseCase:
I open the menu, then I open a section. Now, My translation is closed by the redrawn, So it hides my menu.
To open my menu, I apply translation and then remove it and use offsetLeftAndRight to keep it open:
mainlayout.clearAnimation();
mainlayout.offsetLeftAndRight(pxTranslateMenu);
I tried to create my own view to solve this problem. But I have the same result when my items go from GONE to VISIBLE. When items go from INVSIBLE to VISIBLE all is OK, but i have a wrong render (free space where my items are placed).
Is there anyway of doing what i want : Keeping my menu open after clicking on section?
Thanks.
I tried to use some other component to avoid Accordion.
But i have the same problem when an EditText take focus or when i select an item in an AlertDialog.
I just found a way to overpass this problem.
I just create a new activity wich has a translucent part.
In this way, i can do what i want.
I hope that i'm gonna be able to resolve all demand by this way.
I've noticed that animateOpen(), animateClose() and animateToggle() are doing the same function, meaning that any one of them can replace the others.
The only difference that I noticed was that the speed of the animation varies from one method to the other as follows:
animateOpen(), the animation while opening is faster than the animation while closing.
animateClose(), the animation while closing is faster than the animation while opening.
animateToggle(), both speeds are equal.
So, my question is:
Am I missing something? or do I just have to check isOpened() before using any of them?
I'm asking this question because my problem raised when I wrote animateClose() somewhere, thinking that if the sliding drawer is already closed then no action will be taken, but I found out that it behaves exactly the same as animateToggle().
Confirmed, on two different devices.
animateClose() called on a drawer that is already closed will sometimes animate the drawer to opened.
animateOpen() called on a drawer that is already opened will always (?) animate the drawer to closed.
The immediate functions (close and open) seem to work as you would expect.
Given this, I would suggest subclassing the SlidingDrawer and overriding the 5 methods that open or close the drawer. Using a few member variable booleans, you should be able to determine the real state of the drawer and call (or not call) the appropriate superclass method, updating your state accordingly.
(It might also be necessary to implement the OnDrawerXxxListeners to keep your state correct; my drawer is only opened and closed programmatically, not using the "handle", so I didn't test that.)
Edit to add: The nice thing about doing this is that you can add an isOpening() and isClosing() based on your subclass's state plus the existing isMoving() method.
animateOpen, animateclose and animateToggle public methods will make the slide open,close or toggle with animaiton respectively. The methods have to be compared with open, close which will open and close the slider without animation. The speed of animation should not change in default implementation.
i a facing very weird problem in my app. i am inflating a layout on pressing menu key. and setting that layout on popupwindow. the prob i am facing is that when i install build on device and press menu key, popup does not show up. but if i navigate to some other screen and come back to previous screen, menu key works perfectly.
even if i cllose app and open it next time, menu key works fine. it does not work for the first time after install.
thanks in advance.
Maybe you set your click listener for the menu button in the wrong lifecycle method? Perhaps it doesn't add the listener until after onPause()? Seeing some source would be very helpful to be sure.
I think android pretty much decides on its own when it updates its layouts and redraws the view. Maybe your newly inflated view doesnt affect the other layouts in a way that makes this seem neccessary. I would try to call requestLayout()/forceLayout() on the main layout...
Not sure though...
What I want to do is the following:
I have 4 tabs in total, but in 1 tab i want to have multiple screens which the user can change using the menu
I can capture the event of when the user presses the right button, so no help needed there:)
what I can't do is starting the Activity without removing the TabBar!
I found some information about changing the view of the framelayout, but i really want to start another activity in the layout, not just change the view (I want to keep my code clean you see;)
thanks in advance
so in Tab A I want to be able to use Activity A and B
The only solution I found is still replacing the view, but doing it through ActivityGroup, so the code would still look normally and would be separated in activities. Works great, but there still is needs for hacks like back button press and stuff.
Scrapped this idea, though, since later I wanted more flexible and more stylish tab bar, so I wrote my own. Works like a charm and took some 2 working days to code.