How to display a particular portion of a layout on screen? - android

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

Related

How do I make a section of an activity always-on-top?

Had a question about making part of a View Always-On-Top. Please see the Groupon picture below. The black window at the bottom where it says "From $29" & "Buy!" is always on top of the activity page. Meaning the rest of the page is scrollable above that black window at the bottom. Please note I only want this activity to have an Always-On-Top
How do I make a portion of the activity Always On Top? And what kind of layout did you think they used for Groupon? I was just going to make a RelativeLayout and layout_alignParentBottom="true".
You could probably get away with having a vertical linear layout with two children. The first one a scrollable area and the bottom a view with whatever it is you want to be 'on top'. Since there's no transparency there's no visual difference between having the black view as always-on-top and having one view on top of the other (in the y-axis, not z-axis). Plus, if you do it this way you can reach and see the bottom of the scrollable view's content.
To the best of my knowledge, the best way to do this is by implementing a BaseActivity with this View, and have all your activities extend this activity instead of the standard Activity.

How to Create menu top and bottom both of them in Android?

I wanna create a menu that be seen when clicked on the center of screen like Aldiko.
I've tested PopupWindow for create menu items but I didn't any solution for trackbar.
Are there any solutions?
Using Default Menu you can create Bottom or TOP layout. So you cant used this. But you can create your own layouts. Align one layout to top & second to bottom. Initially did INVISIBLE both layouts, when you click on center then VISIBLE both layouts.
You can use split ActionBar for getting something like you want. The only repercussion of using it will be the look in different screen modes (portrait and landscape). Your action items will align themselves as per the available screen space. Let me know if you are looking for some code for doing it with ActionBar.
You can use FrameLayout and put the main app layout on back frame and menu (with transparent background) on the top frame. Initial set the visibility of the menu layout to invisible so you app main layout would only be visible. Now when you clicks on the main layout just change the visibility to visible, when user press again set the top layout again to invisible.

Sliding Drawer with multiple handles

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.

Android UI - Linear Layout

I'm displaying some controls such as text boxes above the game screen. When I hide the controls and then re-display them using setVisibility(), they move off the screen, however I can just see the bottom border of the bottom-most control, and selecting that brings all the controls back to the original position.
Can any of you tell me what is going on, should I be trying out some other layout?

Sliding in a layout for user input

I have a ListView and each item contains a TextView displaying a number. I'd like to give my users the ability to change this number while staying on the ListView (as opposed to drilling down into a detailed view by clicking on the list item).
What I'm looking to do is to slide in a layout from the bottom of the screen that covers about half of the screen. I'd like this layout to be OVER the Activity behind it (as opposed to being part of that Activity's layout and simply showing it). I'd also like it to be model (or seem modal). Meaning the Activity behind it can not be focused and manipulated. In this layout I will essentially create a calculator.
What I need help with right now is:
1) How to display a layout over the current Activity
2) How make the background (the Activity) modal
Could someone point me to some tutorials/resources and/or give me a few tips?
use an Animation. here is a small tutorial on them: http://developerlife.com/tutorials/?p=343
initially, the view you want to be modal must be placed where you want it to show up(and visibility set to gone).
use a translate animation to visually move the view from below the screen to halfway up the screen. once the animation starts, set visibility to visible
try disabling all views that the user should not be able to interact with after you have started the animation holding the calculator view

Categories

Resources