Android - SlidingDrawer handle at the right top corner - android

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.

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.

Android app icon move inside left corner

When my activity opened, I need to move application icon which is displayed on left side of action bar to bit left inside
How can I do this?
If all you're wanting to do is have your icon not butt up so close to the left edge of the screen just provide a custom drawable that has a little extra transparent padding on the left side. I've done it. Works like a charm.

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.

SlidingPaneLayout setCoveredFadeColor () and setSliderFadeColor()

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.

Layout over layout that can move

I am writing an Android app but cannot figure out how to have a layout over another layout that can animate up and down to show and hide its contents, but have the bottom layout's imageview, shrink to fit the new area.
An example of what I am trying to do is in this iPhone app.
http://itunes.apple.com/gb/app/alex-ze-pirate-comic/id526432227?mt=8
Screenshots 2 & 4 show the states that I mean. When the top layout goes down to leave just the toolbar, the imageview gets taller to use the extra space provided.
Hope you understand me.
Thanks,
Ashley
The ImageView in this case will stay the same. Your second View will simply be covering it for some time. You can achieve this effect using a sliding drawer.

Categories

Resources