In Android, I want to create a particular control which may require to set the location of a component by fixed coordinates.
This is what I want to do. These screenshot are taken from a swing application of mine. I want to clone the buttons on top and their behaviour, into an android application. Basically if there are too many buttons in the menubar, left and/or right arrows appear, and clicking on them will scroll horizontally to access the hidden buttons.
I need to be able to set the coordinates of an horizontal linear layout inside another one, and even to set negative coordinates in order to scroll on the right.
I'm doing this using a null layout in swing. Can I achieve this with Android ?
I'm not sure if an HorizontalScrollView can do this. Could someone point out a good tutorial or something related to what I'd like to do.
I think a HorizontalScrollView can achieve what you intend to do with your Menu Bar. You don't need these "scroll" Buttons, because a user can swipe the menu.
You can nest LinearLayouts together, however you want. if you want to control their flow try to apply margins to them. You can set fixed Coordinates in an AbsoluteLayout, too.
Consider using a gallery? If not gallery, then a child or cousin of it. As far as I know, there is no ViewParent that will allow what your are shooting for.
Hope that helped ~Aedon
Related
I am working on a simple Android application that should contain a webview and two control-panels.
One small control panel should be always visible and the other one should inflate when a special button on the smaller control-panel is clicked.
Implementing the webview is not a problem. But I am not sure which layouts and containers I should use to implement the control-panels on the right side of screen.
Is there a common way to get these control-panels? And which Layouts and Containers should I use?
Here is a picture of how I want to arrange the screen.
I hope someone can help me. Thank you!
See MotionLayout, you can do this with very basic motion layout ,you are going to have contraintset for invisible panel and visible panel.
think of first contraint set ConstraintSetas constraints that you would use when side panel is not there another ConstraintSet when it is there , then you are going to have a Transition with OnClick attributes , and you reference a button in the visible side panel , when that button is pressed motion layout will interpolate between first and second constraint sets. Here is similar example
I want to make a layout where you can swipe right and left to change the view content. However, I don't need to change the layout, I just need to change the texts in the TextViews and some visibility changes when swiping right or left. Do I need a ViewPager for that? And if yes, could you give me a link to some example.
I'm just a bit lost, I don't know what to google (and that's about the only problem google can't help you with:)
take a look at TextSwitcher or even a ViewSwitcher if you just want to change the text and you can check gestures out for the swipe action, if you decided to use ViewPager you can check the example provided above, or search google for more examples I am sure you will find lots.
http://androidapt.wordpress.com/2010/11/19/pulse-news-reader-an-android-app-that-kicks-rss/
Gallery inside ListView it's clear, but:
What is the technology that allows you to show a ScrollView under opening ListView?
How to make gallery and top bar move down by touching screen inside opened Scrollview?
I don't need the direct code, just show me where to lurk for this info.
I though that it uses SlideDrawer, but it reacts only on touches, then i think it is something similar to SlidingPanel
It is a gallery with left margin adjusted.
Accept Mark's answer as right way to made it.
That is not a Gallery widget, AFAICT. My guess is a LinearLayout in a HorizontalScrollView. I am impressed that it works -- I wonder how much headache was involved. In terms of your questions, I have no idea what you are talking about and how they relate to the video
Yes Mark, We have reengineered the pulse app, It is the gallery with its left margin adjusted.
and the center locking on gallery item click is also overridden.
Is it possible to create a layout based on (background) images? For example, there is well know app called Appie that uses this picture as a homescreen:
I might be able to recreate the layout with a TableLayout, but this will be difficult to get it perfectly aligned with the buttons in the image. The default layout options make it very difficult, or maybe impossible, to allow for selection of the buttons on the image (especially when the buttons are in an arc-path).
Can anyone tell me how this is done?
I had some issues positioning a badge on the corner of a view. You can check my solved question:
Positioning a badge bubble on the left upper side of a button
About how it can be done. I would do it with a RelativeLayout and TableLayout as you mentioned, but to be completely sure, you can use apktool to see how the xml are done but it might be ilegal to do it.
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