Android. Making my object appear anywhere on the screen - android

If I want a bunch of objects that appear let's say middle, middle right and occupy have the ability to occupy any part of the screen, would I use gridlayout or relative layout and dp to customize the location?
I think I explained it badly. If I used an analogy, it would be like whack a mole with the hole screen. I was thinking of making a large amount of rows and columns in gridlayout or just using dp. Any insight or suggestions?

The thing about gridview is that its entire purpose is scrolling. If you have lots of data and want to scroll through it in a grid, that's the right answer. If you have a fixed amount of data you want to display in a grid, you want something else- a TableLayout likely.

Related

Android: Scrollable and zoomable container

I'm looking for a way to display views (like buttons, checkboxes, images etc) in a container, which might be bigger than the actual screen size.
A ScrollView within a HorizontalScrollView is no option, since you're only able to scroll one direction at once, not diagonal.
I have yet to find a simple solution to this problem. A zoom function would be nice to have, but that's not as important as the ability to scroll diagonal.
Are there any components out there able to do things like these? Doesn't even have to be for free.

Vertically long user interface

I made a UI with many UI elements such as button and it takes a lot of space vertically.
The UI fits on my phone (it's 16:9 like many), but on phones with a different screen ratio, the buttons on the bottom are cut off of the screen.
I'm using a linear layout. How do I fix this?
Instead of trying to create a UI that is like an image and displays at a fixed aspect ratio, start thinking about designing for resizing. To accomplish this, you need to make decisions about what in your layout must be fixed in size, and what can acceptably resize or scroll.
Importantly (and this is my own stylistic opinion), you should avoid layouts that clutter the screen or fill it with detail. Your layout sounds like an input form of some sort; one solution in your case might be to let the controls in the upper part of the menu scroll, while anchoring the buttons at the bottom of the screen, or to just place the whole layout in a scrolling view. But ask yourself: will this be user friendly? I suspect this solution will look dense and (on really small, resistive displays like that of the LG Vortex) become hard to interact with.
Try to separate your UI into easy to comprehend little "nuggets", omit unnecessary information, and if you must, split the UI into different activities or fragments.

Stretch ExpandableListView to fill screen vertically

I'm an Android newbie. I have an app whose main screen uses an ExpandableListView with only 5 rows. Is it possible to stretch these rows so that they fill the whole screen? Currently only half the screen is occupied and there is a large empty space.
I have tried match_parent, wrap_content for the list's vertical height but nothing helps. Please assist.
Changing the height attribute on the list does not help because it only tells the listview how much screen space it may occupy.
The individual items your list is displaying are not affected by this, as they will still follow their own layout rules on how to use available space in the listview.
To solve your issue, you might want to look into extending BaseExpandableListAdapter. You can define a custom layout for the listview items, in your case you'd probably just make the item views a bit bigger so they take up more space. You'll find detailed tutorials on how to do this all over the net.
However, using this approach (with a static list size of 5 items), you'll eventually run into the same issue again on devices with larger screens. Your custom list may now look like you want it to on a 4" smartphone, but have a large empty area on a 10" tablet device.
Depending on what purpose you are using the list for, you might want to rethink your UI design approach.

How to put images at exact location dynamically

I saw this somewhere and was wondering how to achieve this.
suppose i have a shelf background
and i have cover images of books. how can i put those images exactly on each wodden plates edges dynamically.Number of books are not fixed they might go beyond the capacity of shelf then shelf will also grow. Each level of shelf contains maximum 3 cover images of book.
can i do this on background or do i need to draw a shelf on canvas or something else??
Once I tried this kind of UI , There might be several approach , My approach was ,
I had a list view with background as 3D shelf , not like the one which you have shown which has white color wall and other things. Background(3D shelf) which I used to fit entire screen , and space each row of list item exactly to the row of 3D shelf and in list items have 3 buttons with horizontal orientation.
There is already an app called Shelves , Check UI there , it is open source , code there might help you better
http://www.androidpolice.com/2010/08/19/app-of-the-week-shelvescatalogue-your-possessions/
You can achieve it. But you need to be very precise calculation for the width of shelf.
take FrameLayout. Now In this FrameLayout
take ImageView with this shelf image. Add it to FrameLayout
In FrameLayout, take 4 LinearLayouts with horizontal orientation for 4 shelves and adjust its height and left margin exactly as per shelf
add ImageViews of books in those LinearLayouts

Dashboard pattern: HorizontalScrollView with pagination or ScrollView?

I am starting a new application and I am willing to use the Dashboard pattern.
For example: The Google IO app uses it:
My issue is that the amount of buttons will be more than six.
I'm not sure if I should use vertical or horizontal scrolling.
Vertical scrolling could be done with a ScrollView or a GridView but I am not sure which would be the easier way to implement the horizontal version.
I was thinking of using an HorizontalScrollView but it doesn't have pagination. It should feel similar to the tweetdeck app.
How would you implement it?
My issue is that the amount of buttons will be more than six. I'm not sure if I should use vertical or horizontal scrolling.
IMHO, do neither. Reduce the number of buttons. Watch the 2010 Google I|O presentation on this design pattern -- the point behind the dashboard is to only surface a few items.
I would go with a vertical scroll. It is way more natural to scroll down to view more content of the same view.
A horizontal scroll kind of feels like you switch to another part of the application.
I have an app that uses a gridview with vertical scrolling but I dynamically adjust the number of rows in the gridview based on the width of the actual screen so that it in landscape or in a bigger display it uses more columns and avoid scrolling alltogether in most cases.
However in my case it is more of a search results display of categories and not a dashboard. I believe the whole point of a dashboard is to have only a small number of button (e.g. max six or so).
What you could do is dynamically interrogate the screen real estate and if there is not enough room just show e.g. 6 buttons of which one is a more/utils or whatever button. Sort of like the options menu does it.. but on a bigger screen display them all.
It would be interesting to scroll based on the orientation of the device, so you would scroll horizontally or vertically if the device is oriented that way. This would let you maximize the screen real estate.

Categories

Resources