I understand the items that are visible to the user will be loaded when using GridView. Does this also applied when using GridLayout?
I currently working on laying out the applications' icon like the applications screen does. When user pressed the icon of the application they are allowed to arrange the icon in an unoccupied space.
At the moment, I don't know which widgets is preferred to use. If GridLayout behave the same as GridView, I would stick with that so no need to change the code.
If you want to be able to drag icons to rearrange them I would consider using GridLayout with RecyclerView. Take a look at Drag and Swipe with RecyclerView
Part Two: Handles, Grids, and Custom Animations.
If you are unfamiliar with RecyclerView and ItemTouchHelper then also look at Part One first
Related
I want to display menu items in a GridView-like container on top of the screen with scrollable content below. On scroll I want the GridView to shrink and resize and lock on top of the screen. In other words, imagine a CollapsingToolbarLayout where instead of an expanded image there's a Grid of menu items and instead of the collapsed toolbar there's a single bar of menu items.
Expanded:
Collapsed:
Is it possible to achieve this behavior? What would be the easiest way to do so? Any libs? I would necessarily need to use a GridView, as the number of entries is limited I'm quite flexible in building the layout. Thanks for any tips and hints.
Yes. Try to create two different linear layouts. One for collapsed and one for expanded state. Then manipulate them with setVisibility()
Fill the layouts with apropriate data in onCreate.
If you don't know the exact amout of elements you want to hold inside you expandable field(is is not fixed), consider using something like gridView
You usually traverse a list by scrolling through the views that are placed one after another. What I'm trying to achieve is similar, but the views would be stacked on top of each other. The views will also cover the whole screen. So when you scroll, the top view slides away (or uses some other transition animation), but the bottom one is not moving underneath. You can imagine that the views are like the papers in a top spiral-bound notebook.
So my question is - does something similar already exist? I haven't been able to found anything so I might need to make a custom implementation. Oh and the views will each contain an image and there might be quite a few of them, so it will need to handle that (I was thinking of using Android Universal Image Loader). Thanks.
Sounds like you want to use Depth page transformer, via http://developer.android.com/training/animation/screen-slide.html#pagetransformer
I am developing an application where i need icons to be floating on my panel. I am not sure which control and layout will be suitable for this. I am attaching an image to make you understand what i mean. I want the same two column icon based layout. And if i will scroll down it should be in a sliding way and scroll down. Please let me know which layout and control is suitable for sliding window where icons will be appearing in Android. I am new bie so i am sorry if its not a good question.
If you have a fixed number of items, you could simply use LinearLayouts (with a ScrollView as the root view of the layout). If you have a large number of items or you don't know in advance how many items you will have, use a GridView (and do not place it inside of a ScrollView).
Suppose I have a list of data to be displayed. I know how to display it using a ListView And it is very simple and easy to do it that way. But I am looking for an alternative way to achieve the same. I don't expect to have more than 20 items in the data set I am planning for.
I was thinking of a number of squares that the user can swipe to see the next one etc, similar to some widgets on home screen.
I came across android.widget.StackView, any advice available for this?
You can try StackView (http://developer.android.com/reference/android/widget/StackView.html).
This is how the Gallery and Youtube widgets are rendered.
ListView is the best option for listing lots of data. It has very efficient loading property. But if you do not want it any specific reason, you have to use ScrollView and in ScrollView, you have to place a LinearLayout and in that LinearLayout, you have to place multiple LinearLayout(for each items of data).
Maybe you can use a ViewPager (available also for lower versions of SDK through compatibility pack).
http://developer.android.com/training/implementing-navigation/lateral.html - see also the project example top right of the page : EffectiveNavigation.zip
You can use a GridView, if you want to show multiple items on a page in a different fashion than in ListView.
You can also use ViewPager (from android 3.0, or with the support library) with your custom views.
I have a list of items loaded.
What i want to do with the items is load them into a list in a widget.
But i know list widgets are only supported on 3.0 and above.
So what would be the work-around to get this done?
EDIT:
Maybe add a textview each time a item is loaded...and load the text views into a scrollview?
There is no way to support scrolling on a stock home screen before 3.0. Widgets use the RemoteViews framework, which on Android 2.x only supports AbsoluteLayout, AnalogClock, Button, Chronometer, FrameLayout, ImageButton, ImageView, LinearLayout, ProgressBar, RelativeLayout, TextView, and ViewFlipper. The only way you could make something at all list-like, is to have up and down buttons for scrolling between items (note: this could only work for complete clicks--you couldn't have it scroll while holding down the button, for example).