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.
Related
I just wanted to ask if this is possible in android studio
As you can see I pointed out the blue area that I needed to change after I pressed the Send Profile button . Change I mean is that I can hide or something like that the fullname,address,phonenumber,emailaddress etc because I wanted to add some more forms to fill up.
Thank you if someone can direct me to a reference.
You can have a fragment place holder for the outlined blue area, and do fragment transitions as you want to go.
Each form can be represented by a separate xml layout file that you can place in this place holder.
Well... if you are using something like a Constraintlayout you can just reference the views and set their visibility to View.GONE
So you would put that into the onClickListener of the Button (after validating perhaps) and then you could hide those views.
You can also use fragments but those might be hard for a beginner (which I assume you are) so instead for replacing those views you might be able to just use a mix of setting titles/hints of textfields to something different and hiding views (or showing new ones).
LinearLayout would also make this easy because views are just ontop of one another like in your case (only the blue area) so hiding/showing is straight forward.
Simplest way would be putting another LinearLayout there, and all those other elements into this new LinearLayout. Then you can just use
findViewById(R.id.yourNewLinearLayout).setVisibility(View.GONE);
to hide all those things.
One activity in my app looks like below picture. In the below picture ,can any one suggest that best way to implement view,
view in my app
and when i click one of the options(filters in app) available on activity,
the view will be extended like below
view after one of the option selected
For this, i want to use a horizontal linear layout for below options bar,
when one of the options clicked, i wanna use slide up functionality and views show and hide functionalities.
can any one suggest better design for this . thanks.
I think for most apps, all toolbars should stay in the same place throughout the execution of the app. When the toolbar item ("Veg & Non Veg") is clicked, the filter should appear above the toolbar instead of below it. You can still use the slide up function, just have the toolbar layout displayed above (higher z-index) the filter linear layout.
You should also standardize the sizes for the distances/times to each location, personally I think the first one looks better.
Other than that, I think your UI looks pretty good!
I'm building an app where you can edit a detailspage. Right now I set the visibility to GONE and to VISIBLE because all the Views (for showing and for editing) are in the same xml file.
That makes more than 80 views, so I got a Lint message that this causes bad performance.
My Question is cann I use ViewFlipper (and is it possible to use two xmls for this) or do I better make use of two Fragments?
(fyi: I am also planning a animation between showing and editing, if that changes what I better do)
thx in Advance
You do not need either: a ViewFlipper or two fragments introduce unnecessary complications. I would separate showing and editing on different layouts (one XML file for each), and construct a different activity with each layout. When the user clicks on "edit" start the new activity (with an intent) and go to the edit screen. Then after saving the data just finish() the activity.
That is what we do, and it works great! Sometimes the "easy" solution is the best one, as in this case.
As to the animation part, there are already great answers here on Stack Overflow, such as here or here.
In case you want to keep the ActionBar while you animate between show and edit, two fragments would seem like the way to go. You can also have two layouts and inflate them independently, so that you don't accumulate so many views in one layout. Keep in mind however that (unless you create the ActionBar and fragments yourself) you will be limiting yourself to Honeycomb 3.0 and beyond.
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.
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