SlidingPaneLayout setCoveredFadeColor () and setSliderFadeColor() - android

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.

Related

Android swipe right to left to expand fragment

Hi guys I am an android beginner. I want to make an fragment at the right edge of the main layout and it could be expanded/collapsed by swiping from right to left/left to right (please watch sort video below).
https://youtube.com/shorts/HKOvfDVS03M?feature=share
My problem is I could not know how I can start implementing since I'm new to android. Please help to give a sample code. Thank you
You can achieve the same using navigation drawer. Navigation drawer is menu or layout which slides from edges of the screen. As you are a beginner you need to learn the concepts first. So, try to learn navigation drawer first. As per suggestion you can watch below video.
Navigation drawer
As you complete the video you will know what navigation drawer is and how to implement it. Now, as you mentioned in your video it's a calculator. So, drawer is given specific height and width as well as it is placed below the calculating screen. SO, I assume that you know basics.
Using relative layout and it's property You can use
...
android:layout_below = "calculating_screen"
...
This will place your drawer below the screen and you can specify `android:layout_height =match_parent" in your drawer file to cover the remaining screen. And then after specifying width you just need to adjust the gravity. you just need to change the gravity line.
...
GravityCompat.END
...
from
...
GravityCompat.START
...
GravityCompat.START allows drawer to expand from left-right. If you want right-left then use GravityCompat.END.

Sliding drawer - how to make it pull from above?

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.

Adding a custom image onto a Navigation Drawer's center

I'm experimenting for the first time with Android's Navigation Drawer. I think it is a very elegant way to provide an application menu. However, showing my prototype to some friends, it seems that it is not quit intuitive to search for a menu i) on the top left corner respectively ii) on the left side of the screen.
To provide a "user hint" for case i), I added a custom image by creating an ActionBarDrawerToggle. This results in following design of the title bar (the little arrow is the cutom image, while the red star is the application icon):
Now while developping, I thought this is quite obvious, but apparantly I'm wrong :). So as a second idea, to support a user to find option ii) described below, I tried to figure out how to add a further image at a specific place, which I want to explain with following image:
Don't look at the design itself in the first place, but following: the image must be placed outside of the "view bounds" (when the navigation menu is hidden), and also exceed the navigation panel itself on the right side (always). Is this in any way possible without customize the entire navigation panel? I really wonder why I can't find much about this idea, since I think it is a very nice option to provide for the user (as long as the arrow don't disturbs the application usage)
Although I haven't actually tested it with Android's Navigation Drawer,
did you try putting an imageview in your activity's layout? The image would be placed in the middle vertically and on parent left horizontally. I believe this would work (i.e. the image will get pushed when you open the drawer. As an improvement you could also change the image itself in the drawer's callbacks, so that you have an arrow pointing right when the drawer is closed and an arrow pointing left when the drawer is open.
Hope it helps.

Android SlidingUpPanelLayout and slidinguppanel

I am having problem to incorporate the sliding menu and sliding up panel from
http://www.michenux.net/android-sliding-menu-part-22-690.html
Android: Up/down animated sliding menu
(https://github.com/umano/AndroidSlidingUpPanel)
When it first launched, the bottom panel showed up ok, I did a click/touch on the
sliding up panel, it goes up alright to show the second screen. Problem come when I click/touch
again on the second screen, it slided down but the screen overshoot to lower screen.
It doesn't goes back to the original location.
I have marked problem with "?????" and red color.
I discard the use of the sliding from left menu. The Android's Navigation Drawer suggested by the slidinguppannel solved this problem.
http://developer.android.com/training/implementing-navigation/nav-drawer.html

Android - SlidingDrawer handle at the right top corner

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.

Categories

Resources