I hope I'm not too vague with this question. For some reason I've developed an inordinate fear of being ambiguous with my SO questions :-)
I need to make a design decision and, having just recently started in my Android efforts, I thought I might ask about its potential dangers among those who've been in the trenches for awhile.
I'd like to build a gallery within a gallery. The outer widget views will scroll horizontally, while the inner views--being galleries themselves--will scroll vertically.
Has this been tried/crashed/burned in the past? If so I'll rethink my UI, but I wanted to ask in advance before I spend a lot of time chasing the wrong dog.
Thanks,
Jeff
The gallery widget cannot scroll vertically. There's no way to change orientation, it can only be horizontal. You can build it custom, something like attaching image views to list views and such, or you can use something like a wheel scroller, like this one, called android wheel, and do some tweaking to make it look and work the way you want. These two SO posts might help as well, for the vertical aspect.
Lazy load of images in ListView
Vertical gallery in android
Related
I have a screen in my Android Application that only takes up one screen. Because of this, I thought it would be really quick and easy to just use LinearLayout as my base layout:
I thought this would be good. However, I am thinking, what if someone uses a 2.7 inch screen on their smartphone? Or they do split view. They might not be able to see everything without scrolling. So, is it good practice to do the layout the way I am doing it or is it always good to allow the user to scroll to see everything?
Since many different devices exist, some with very tiny or otherwise abnormal screens, it is a good idea to make the layout scrollable when needed.
This is achieved by encapsulating your layout in a ScrollView.
Other popular methods to tackle this are using ConstraintLayouts, or the legacy Relativelayouts, which are placed relatively to each other, and relative to screen borders.
What if a layout gets partially off-screen? Maybe it is no big deal, but maybe it hides an essential part of the layout (e.g. a 'next' button, or some important information). So yes, your worry is justified.
As I believe it is good practice to make an app work on as many different phones as possible, I do believe it is good practice to make sure a layout does not appear partially off-screen.
I have been looking for info about which could be the best way to draw a view like the ones shown in drefrag programs. An example con be found here.
My first attempt was to use a grid layout but it seems that could be slow for a big ammount of cells. My maximum could be between 150-200 cells.
Could anyone that has dealt with this problem share his/her experiences or suggest a better way to achieve it?.
Thanks in advance.
I would use a SurfaceView which I would draw on.
You might be able to use a TableView and change the background of the cells, but I am not sure if that is possible.
I am developing an app and I would like to have 12 ImageButtons (3 x 4). centered in the android screen and the center section of the screen where the ImageButtons are located to have a color or gradient background.
Is it best to do this with a TableLayout or a GridView... or maybe something else. I am a newbie to Mono and Android so any help is appreciated. I was hoping to do most of the layout in the designer, but I am not sure of the best approach.
Can anyone point me in the right direction?
I think GridView is better to use as it supports recycling of views. In case of TableLayout all the views remain in memory.
Even if the no of buttons increases, GridView will take care of it.
Make sure you are implementing view recycling correctly, or otherwise you may have a memory leak.
If there are only 12 buttons, a TableLayout would probably be simpler to implement because you don't have to mess with the adapter. If you need scrolling or the number of buttons may increase over time, you would probably be better off going with the GridView.
You may want to look into the GridLayout in the Android Support library v7. It is kind of like the TableLayout but seems simpler to do things like just wrap button into a set number of columns.
I've come to the conclusion there is no Horizontal Scrolling for gridView. The work-around solutions online are to use Gallery in a multi-row format.
However, from what I understand, Gallery requires image files. (Please correct me if I'm wrong.)
I want a work around that can scroll tables (aka a grid view) . I'm basically making a Calendar where I'd like to scroll horizontally. It doesn't have to be as fluid where scrolling vertically shows each additional week that comes into view. Horizontal scrolling can simply scroll month by month.
Nevertheless, I'm wondering if there is some sort of work-around with Gallery? Or does Gallery absolutely require images?
Ah I'm a noob. Figured it out on my own. Here's a link for people who want to learn how to do it with Gallery, but I just came across ViewPager which does the same and I believe my answer will be found there. Thanks!
At the moment, I am using Euro 2012 app and it has some interesting layout parts. If you go to matches->knockout screen, you'll see 3 screens like this.
If you slide left or right, you move between them not like between one activity to another, but just like all these elements are laid on one big canvas and you slide each screen into focus. Even thou, if you slide left/right, the screen cannot be stopped in the way that half of each image is visible, so I guess it's not a big canvas. Somehow you can slide screen like one big image, and yet it always lock perfectly as if they used 3 activities for this.
How did the do this?
It's a ViewPager, available in Android support package and described in their blog.
The designing is not so much difficult, As i think to draw that boxes showing quarterfinals, semifinals.
They having layout( we can do by placing image in background also).
The major role played by FrameLayout which shows you that effect(emphasis), the flages are fetch from url as matches are decided(not essentially images only names are sufficient as flags came inside app and gets applied as updated).
After your click i think the start image gets change it's just replacing that image with new one.
As you said they are not on single canvas (but if they did customization of heir Viewpager that it's not stopping in between activities), but i think it's on single canvas.
If your taking about quickness of loading and all it's up to you as much code and processing you optimized it gives you smooth feel and fast processing.
We can appreciate the work but we can not say it's too much difficult as i think it's quit easy...
Hope this explanation helps you to understand ....