I want the widget which is used in Samsung Touchwiz UX, in file manager, Music player, and some other apps, that two ListViews are in left and right side of the tablet, and there is a separator in middle of them which can change the widths of the left and right side ListViews when touched.
Where can I get this View, or, is there any suggested way to implement that?
thanks a lot.
This is made with Fragments and Fragment Activity! You can start reading Android documentation about "Building a Flexible UI" http://developer.android.com/training/basics/fragments/fragment-ui.html and "Combining Multiple Views Into One" http://developer.android.com/design/patterns/multi-pane-layouts.html#combining-views
It's good practic to always use fragments.
Related
I was recently looking at apps like Blinkfeed and My Magazine that run as fully functional apps but live right next to the Android home screen. Given that widget can only take up a certain amount of space of the home screen and have limited functionality,I could conclude that they aren't widgets.
I would be interested to know how companies like HTC and Samsung implement these full screen apps that live to the left of the screen. I tried googling it but perhaps I am not googling the right thing as I couldn't find a word about how both of these things were implemented. Hence I decided to turn to the wisdom of the internet !! :D
Consider homescreen as the Activity that has floating buttons (those that are at the bottom).
This activity (fragmentactivity to be precise) contains ViewPager of fragments on each page.
And the leftmost page/fragment is the ListView (Blinkfeed).
(*) are the floating buttons , probably LinearLayout that has transparent background and contains buttons.
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 have an app on iPhone with cascading design like on the picture, and I'd like to port it to Android. Is there a simple and recommended way to do this?
The section menu on the left (Section A, B,C,D) is the first that the user needs to select, then the user needs to pick a category in the middle (all, popular, pc, xbox,...), then he is presented with a list of articles for chosen category.
I could imagine doing it with three ListViews, but then the app could also listen to a swipe gesture to make the rightmost ListView "full screen", and hide the first two listviews. I could implement a swipe listener for the whole activity and set first two listviews' visibility to hidden, right?
Are my assumptions correct and would this be the right way to do this?
It could definetly work the way you explain it - if the design is good is another discussion. Personally I'm not a fan of throwing in endless amounts of data in one screen, when the space is as limited as it is on most mobile phones (I would probably do it with 3 different screens with a ListView on each)
Implementing the mentioned swipe gesture is doable and you could certainly just hide the two other ListViews with the function setVisibility( View.GONE ).
Hope it helps.
You might want to use the new fragments API, it's specifically built for this kind of thing (and it's compatible all the way down to Android 1.6). Also, as KasperMoerch says, putting all that info on a small screen can get ugly. Using fragments will make it easier for you to gradually increase the amount of information displayed as the screen size increases.
I'm not sure you can just listen for a swipe gesture over an entire activity like that. I think you have to wrap the fragments in a custom view (for example an extended LinearLayout) and do the swipe listening there. However, achieving a finger-tracking animation (i.e. where the rightmost pane follows the finger precisely as it swipes across) is a pretty daunting task (I wouldn't really know where to begin, probably in the custom view though). The best way (I think) to do it is to make a compromise and just start an animation (right-to-left slide) when you detect a swipe. However, the simplest solution is to not animate at all.
You can also take into consideration dropping the swipe gesture altogether and just providing an "expand" button.
I have a tab-based Android app. Currently, it does not support landscape mode - the one and only activity swallows all orientation changes. Now, a user asks that I support landscape for the sake of the hardware keyboard convenience.
On one hand, it makes sense. On the other, the default behavior of a tab host is rotating the tab strip; when it does, it takes a good one third of the precious screen space for the tabs alone. So I lose a lot of real estate.
Are there any common ways out of this conundrum? As far as as I can see, a vertical tab strip is not an option.
I suggest following the technique discussed in Timores's answer to android:orientation="vertical" does not work for TabWidget, where he describes how to set up the TabHost to display the tabs on the left of the screen, with tabs vertically stacked.
Don't use tabs. That's probably the best suggestion anyone can give. Tabs on a mobile devices are a great way to display quick information, and a lot of information. But when it comes to handling user inputs, it doesn't really help considering that it's a mobile device with limited real estate.
While this has already been answered (and I like the one you accepted--will probably implement it myself), there is another option.
Use buttons instead of tabs to navigate between Activities. Each Activity has the same series of buttons in the same locations, much like a navigation bar on web pages.
You can place your buttons however you like, depending on the orientation or however your design sees fit.
For examples, just look at any of the millions of websites with navbars, such at StackOverflow.com at the top of this page.
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.