Is it possible to display tab buttons at bottom, rather than top? I need to port an application, which was originally designed on iPhone, where the default "tab" buttons are at the bottom.
You can have a look at this topic which gives one known method to do this. However, I suppose that you can obtain an equivalent result by overriding some classes of the SDK.
Related
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 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.
I'm a beginner in Android development, and I would like to create an application composed by three main columns, one for a list, a second one for text/description, and a last one for a MapView. The target is an Android 3.0 tablet, to begin I was trying to use Fragments but It was 'impossible' to use a MapView with the fragment system so I'm trying to do it in another way.
https://code.google.com/p/android/issues/detail?id=15347
However I'm a bit lost with all possible layouts that I can use... And more, I have to add the possibility to hide (for example) the MapView (third columns), so if you have any clue...
Thanks.
Why not use LinearLayout with a horizontal orientation and then hide the controls when they need to be hidden?
See: http://www.learn-android.com/2010/01/05/android-layout-tutorial/4/
You can probably use whatever layout you want, but a good start will probably be a horisontal linear layout for the columns, then have sub-layouts for each column.
You can hide (sub-)layouts by setting the visibility attribute.
I am not sure what the proper term is, but I am trying to add a "TitleBar" to the top of one of the windows in my App. Much like the Contacts App, I have several Tabs along the top of the screen. When you select an item from the list, it loads the next Activity, but that Activity no longer has the Tabs at the top of the screen.
I don't know if it is called a TitleBar or what. The Contacts App has this TitleBar along the top of the screen when you select a person from the list of Contacts.
I am trying to mimick the Grey Bar that says "George Washington"
The Contacts app is open source (as are most of the core Android system apps). I suggest checking it out and looking at the layout you want to emulate. In general, poking around a lot of that code is a good idea to get a handle on some best practices, or just to borrow a few tricks.
In this particular case, they're using a custom View called ContactHeaderWidget, which is actually a FrameLayout wrapping a TextView and Checkbox (styled to look like a star), along with the photo view (which has some special behavior to bind with the multiple contact source data on click and so on).
If you just want the look and not the functionality, though, just adding a LinearLayout with a GradientDrawable background containing an ImageView, a TextView, and a Checkbox styled as a star to your activity's layout should get you there a lot more easily without requiring custom widgets.
I am looking for a UI view that imitates the functionality of the
Google Maps directions screen UI control where it allows the user to
pick the type of directions allowed, either Car, Transit or Walking.
Like this --> http://snapplr.com/50rh
The widget is essentially three buttons laid out horizontally with
rounded corners only on the left of the first and right of the thirdbutton.
I can't see a standard way to do this, although it seems like it would
be a common widget. Is there some other standard way of presenting a
multi-choice grouping in a horizontal layout as a "single" layout
object.
I am not aware of a button bar widget in the Android SDK. You would create one with ImageButtons in a LinearLayout, with custom backgrounds for all (to give the gloss-black look, to handle the varied sets of corners, and to handle the selected vs. not imagery). You would then need to add the toggling smarts, such that pushing one makes it selected and makes the others in the layout not selected.
If you wish to stick to simpler existing widgets, Spinner, RadioButton, or ToggleButton would be the most likely candidates.
I don't think there is a built-in way to do it. I can think of two ways to accomplish it. The first would be to create a custom style for the TabWidget. The second would be to create your own custom widget. Making a TabWidget style might be more flexible because you could easily come back and add or remove tabs and it would update accordingly. Making your own custom widget would give you much more control over how the widget looks and acts. So really you need to see what would be the best fit for what you're trying to do.
Best button bar I've found: http://androidworkz.com/2011/02/04/custom-menu-bar-tabs-how-to-hook-the-menu-button-to-showhide-a-custom-tab-bar/
It's thought to be used as a replacement for the menu, but I believe it's also great for a custom button bar. I'm actually gonna integrate it in my app straight away :-)
Kudos for androidworkz, the original author.
I think the power control widget does what you want. Looking at the source for the widget, it uses a combination of LinearLayouts & ImageViews to achieve the layout.
Layout file: https://android.googlesource.com/platform/packages/apps/Settings/+/froyo-release/res/layout/widget.xml
Source code: https://android.googlesource.com/platform/packages/apps/Settings/+/froyo-release/src/com/android/settings/widget/SettingsAppWidgetProvider.java