In the android home screen, we have the ability to slide the screen left and right and display multiple pages. Each of these pages has a different set of icons. In the Mac world these would be called "spaces". What are they called in the Android world?
More importantly is there a standard control that can be used to achieve this effect?
There is no such control to achieve this. Once I was digging through the Launcher's source code and this effect is done by creating few LinearLayouts and placing them side by side in the code. Sliding through the "spaces" is done by handlig touch events. Also the grid that handles widgets is created using aviable API.
Unfortunately, there isn't a standard control for that sliding effect.
This is another question about the effect which also contains a few pointers about implementing it.
Related
I am wondering how to achieve some kind of draggable view. I am not speaking about the navigation drawer!
Several other applications implement this kind of views, for example the new stock Android Lollipop Calculator application. There you can drag out the extended symbols view from the right hand corner.
Another application is Google maps. When checking out a location, it's possible to extend the location information by dragging up the bottom information view.
It appears that there are two points where the view is able to lock in, meaning that when pulling the view up to a specific point and releasing, will result in the drawer not closing entirely but to align to the specific locking points.
How is that achieved or is a library required?
Thanks in advance
The stock calculator app appears to use ViewPager to achieve the slideout numberpad. It's a part of android, no libraries so that would be a good starting point.
Here's the class in question (Rest of the code to the left)
I have an activity that must be used horizontally.
this activity shows a map and when i click on it a toolbar supposed to pop from the right side of the screen (which is actually the bottom if we are looking vertically).
(Sorry for posting link instead of image, reputation doesn't allow me images)
http://i60.tinypic.com/xlb12g.jpg
i thought of implementing this toolbar as a container of fragments because each button triggers different stuff to appear on the toolbar.
First of all, is it the best way to implement such a toolbar? or are there more android oriented ways?
Second, i would like that when i touch the "transparent" space under the X button it would send this signal to the map but when i touch the "black transparent" it will not.
From what I've read the only way is when clicking check coordinates and see of they fall inside my area but it sounds too hardcoded and ugly solution.
Is there a better one? maybe there is a way to make the holding layout fit the image and not be rectangular?
For a more android oriented way you can use the Navigation drawer.
I don't know if it fit exactly with what you want but Navigation drawers are a good way to create right or left menu/toolbar.
You can find the documentation here:
https://developer.android.com/design/patterns/navigation-drawer.html
http://developer.android.com/reference/android/support/v4/widget/DrawerLayout.html
I'm porting an iPhone+iPad app to Android. It uses a Split View Controller for tablets which in Android lingo allows you to present two Activities side by side simultaneously (Edit: Android only allows one Activity on screen as mentioned by #commonsware below. The next best thing is to use fragments, but the Action Bar can only exist at the Activity level, meaning it will have to expand the entire width of the screen. It wonder if a Split Activity Controller will be coming to the Android Platform.)
The tablet landscape layout has a fixed left pane for statistics that never changes. The right hand pane functions just like the phone version of the app. Transitions occur exclusively on the right hand pane. i.e. the whole screen doesn't slide when changing activities, only the right pane. How would you recommend implementing this in Android?
Should I use a single activity and manually perform transitions between fragments in the right panel? This app has 25 screens and will have an alternate layout for phones, so I'm trying to plan ahead and do this right the first time :) Thanks for your help!
It uses a Split View Controller for tablets which in Android lingo allows you to present two Activities side by side simultaneously.
No. In "Android lingo", you cannot "present two Activities side by side simultaneously". You can present two fragments side by side simultaneously.
How would you recommend implementing this in Android?
Use fragments. Use a FragmentTransaction to replace the right-hand fragment as needed based on user input. Your overall activity layout could have a horizontal LinearLayout (with android:layout_weight to control the sizes for the left and right sides), with a <fragment> element for the left and a FrameLayout for the right.
Should I use a single activity and manually perform transitions between fragments in the right panel?
Yes, to achieve what you ask for.
I want to add a sliding panel view using cocos2d for android. Any suggestions.
The way i've achieved this in one of my previous android market apps for paintball field designing is to have a separate CCLayer class added as a child to the main scene, and have the main scene responding to the CCTouchesBegan. if the location of the touch is within the co-ords of the visible panel, then call a 'touched' method inside it passing the touch co-ords, so that it can deal with it's own content.
On another panel at the bottom I had a button, which showed or hid the side panel, so it didn't 'slide' or support being 'flung' across the screen, but rather was shown or hidden.
Sliding it or flinging it on/off the screen could be written relatively simply i believe, using a combination of CCTouchesMoved and CCTouchesEnded to track the slide/fling and perform translation on the layer co-ords.
There's nothing to have prevented me implementing a slide in/out using some simple animation, but I had no requirement for it in the app, and hence didn't implement it.
Hope this is at least of some use,sorry i can't provide some worked examples right now, busy with work.
I am making a quiz application in which i am planning to use the SlidingDrawer control for displaying different question numbers. Clicking on a number will allow the user to jump to a specific question.
I have implemented the sliding drawer control but it is able to display only 6-7 buttons inside it depending on the screen size. Trying to add more buttons to it gives an exception.
I tried using a GridView inside the SlidingDrawer but i keep getting an error.
Is there anyway i can have around 20-30 buttons inside the SlidingDrawer control arranged in a grid like manner ?
Please give suggestions on any other way i can implement similar functionality in a way that doesn't take up much screen space ?
Yes, it's possible, as a matter of fact previous Android versions (1.6 if I'm not wrong) implemented the application Launcher that way.
Search the source for that version and you'll have a working sample.