I want to create sliding drawers which comes from right to left which has two handles for loading different contents. Handles position should be in between center and bottom of the screen, so that whenever I slide with any handle, application should show the corresponding content on the whole screen.
I checked earlier sliding drawer's questions and solutions, but could not help to my scenario.
By default slide drawer's handle position is centre right to the
screen. And when I place two handles, second handle is over-lapping
the other, and I can see only one handle.
Tried keeping PaddingBottom as 200dp. Now I could see both the
handles, but second slide drawer's content is shown for both the
handles.
Kept slide drawers inside linear layout, and assigned layout_weight
as 1 for both slide drawers. With this, complete screen is divided
into two equal parts. But I want to use whole screen for each handle.
Could someone help in this regard.
Thanks in advance.
The sliding drawer can be placed in a frame or relative layout according to the developer's site. And you can set the top offset for your layout inside the layout present in the drawer which is in the xml. Hope it works. Worked fine for my code.
Related
I am trying to make sliding drawer menu like the one in the YouTube app. I navigated many questions like this amazing one here. and found a lot of libraries but all of them slide from left to right or from right to left in different one. I want to make it slide from both sides, left to right and right to left via two buttons in the top bar.
You can look at github.com/Ali-Rezaei/SlidingDrawer, which mekes it possible for you to slide from any side.
Use Yahoo Rangeseekbar
The package is
com.yahoo.mobile.client.android.util.rangeseekbar
It will let you slide both the sides and you can choose if you want to display the values on the top of the slider min and max ends.
You can use the standard DrawerLayout from the support library. As it says in the documentation, you can control the placement of the drawers with the layout_gravity attribute. From the documentation:
To use a DrawerLayout, position your primary content view as the first child with a width and height of match_parent. Add drawers as child views after the main content view and set the layout_gravity appropriately. Drawers commonly use match_parent for height with a fixed width.
I have been researching for the same since two days. Here is what i want to achieve. I havent ever tried much animations in android so please clear my approach wherever required. I will have two pages/screens (one visible at a time) Now when I am on page1, on swiping right to left page 2 will be displayed (achieving this is not that difficult) But here is my problem : when I am scrolling to page2 i would like to animate/translate/slide an image from page1 to page2 (without touching the image) and let the image sit on page2. I am just not sure of how to start with this.
I have thought of few ideas
First: I think i should implement a layout larger then window and then do the required animations and scrolling in it using horizontal scrollview.But now here I am not sure how will I make it look like they are 2 different pages(concerned about handling different screen sizes)
Second:I have seen example libraries of draggable gridview viewpager. But here both of my pages will have different layouts
Third:I am thinking of dividing both of my pages. the lower part of my pages will contain framelayout where I will only change the framelayout's content on scroll and perform hide n show trick on the upper part.But here again the trick is how am I supposed to place the image(contained in framelayout) to upper layout with an animation(image sliding to the top side on its own kind of animation)
Any Ideas. Any views/suggestions. Need all of it.Thank You for your valuable time.
This happens when I am trying to move the image to screen's top-left position. It moves in the left top direction as shown in the images below..
This happens when I am trying to move it besides second fragment textview
But the problem is I want to move it besides second fragment textview while scrolling and when scrolling is done it should come to top left of the screen just like the second fragment textview
I have to create to sliders(relative layout with background image) which are partially displaying on the screen on the click of that slider it should move to right and fully displaying on the screen and on another click it should move towards left and partially displaying on the screen .
I have achieved this moving animation but my problem is that Relative layout appearing fully on the screen and I want it to be display only 80%.
I have gone through this and this tutorial.
Use SlidingPaneLayout
SlidingPaneLayout provides a horizontal, multi-pane layout for use at the top level of a UI. A left (or first) pane is treated as a content list or browser, subordinate to a primary detail view for displaying content.
Check this : SlidingPanelLayout
I am having a sliding drawer positioned at the bottom . and below that I have a linear layout of 50dp .
So my layout looks like this :
Where red rectangle is the sliding drawer handle
Now when I slide my finger from bottom of the screen to the sliding drawer , i.e. along the blue path
The sliding drawer doesn't open . It doesn't open because the click activity is captured by the bottom layout.
The sliding drawer opens only when I click EXACTLY within the red rectangle.
I tried making the bottom layout clickable=>false focussable=>false still no good.
Any idea on how can I make the click event of bottom layout loose its click as soon as the finger is out of the layout ? , so that the handle can capture the click
I would suggest you to create the entire linear layout (brown bottom bar) as handler for your drawer. Doing so will allow you to slide the drawer as you want in the second picture.
Or, alternatively, you can make use of FrameLayout to present LinearLayout and drawer's view as with in a single layout and set the width and height of your drawer as linear layout - covering the entire area of linear layout.
Or, at last, implement SimpleOnGestureListener on linearlayout (for upwards direction) to execute drawer's click action.
You said you tried clickable=false and focusable=false... did you also set focusableintouchmode=false? (I would set all three and see what happens).
As I painfully discovered recently, focusable-false only covers the hardware, not the touch screen. I had to add focusableintouchmode="false".. maybe that will work for you too.
I would like to position an element of an activity's layout relative to the top of a sliding drawer handle in its closed state. The standard Layout above relative layout attribute obviously doesn't work given the floating nature of sliding drawer.
It seems to me that the only (non-programmatic) alternative is to bottom-align and used fixed margins or bottom padding to ensure the element sits above the closed sliding drawer handle. This approach is pretty crude and I'm hoping to avoid this because I would like the sliding drawer handle height to be dependent on its content (which is dynamic).
Any suggestions to help achieve a more fluid layout?
You can control the height of the sliding drawer if you want to and I think that is the case with this question. The sliding drawer is just taking some space of the screen and other content should be above it
Can't you use a LinearLayout (Vertical), and set its position to bottom-align