android : how to create GridView - android

I have a requirement to create a gridview like as below:
First I thought of a way, to go with StaggeredGridLayoutManager but that too has static span. If I pass span of two just columns will be created, even if space is available to another item.
Any suggestion please.

This flow layout might help you.
FlowLayout

Check below links, it might help you.
Use multiple autocompleted textview :Bubble-Text-Library(you can change view from xml file also) Link
android-chips(suggested by # Suhas Bachewar) Link
chipview(multi custom color) Link
and many more are there

Related

Onclick event on many pics android studio

I am a beginner in android studio.
In an application there are five horizontal rows. In any row there are ten pics and properties of the pic. Click on any pic put extra to intent and direct to another activity.
How can I write onclick event for all pics?
Should I write 50 onclick events for all pics?
Is there any other way?
Thanks
You can use GridView for the layout you are displaying. Refer Doc here.
And example here.
Add to the ImageViews: "android:onClick="navigateToNextActitivy"
and declare the navigateToNextActitivy-Method in your Activity and put your code to navigate here.
or put a container arround your pics and add the "android:onClick="navigateToNextActitivy" there
In this case you can use a GridView. Here is an example answer where you can find how to do it:
Simple Android grid example using RecyclerView with GridLayoutManager

Staggered collections in Android app

Hi I just watch the last video of Android Design in Action: Collections and I would like how do you approach the following view:
The first thing that I though was use a GridView, but how do you achieve the first item fill two items size?
The other solution that I think is use a normal ListView, but in each row return two items view. And for the first row return a single item.
What do you think about these two approach? There are a better options?
UPDATE:
I want to inflate the collection dynamically from a Cursor or a List.
Check out the link..
http://www.androidviews.net/2013/01/pinterest-like-adapterview/
in that link have Staggeredgridview example with source code try that..
https://github.com/maurycyw/StaggeredGridViewDemo
Not exactly the same scenario, but you may find this post useful.-
Create gridlayout.
Let me help you my friend. Use the following library https://github.com/Utopia-Developers/StaggeredGridView Its an implementation of StaggeredGridView that allows you to set column span on each view in the getView() method of your adapter.

Grid with different item height and width

can someone help me and tell me is this possible in android. I need to have in my app a gridview alike widget, but with different item height and width, like this:
So is this possible, and if so, what can I use to achieve this.
Thanks
For this you need a work around or you can say a third party Library named as "AndroidStaggeredGrid"
You can check it on here
#Darko,
Yes, it it possible to do like this in Android.
There are many ways to implement this. As you said GridView cannot be used to achieve this. For a normal user this will appear has grids.
Ways:
Use fragment for each and every "grid" you can see and each fragment will have its layout to display either 2 or 3 images in grid (No gridview is required here too). Use ImageViews as usually.
If the layout design is same, then you can define a single layout with internal design in the same format. Each row with imageviews - This is not encouraged by the way.
Design layouts for each and every format of design per row. Inflate each particular row to a list (using custom adapter). Based on position in getView() you can control which row design to be added to list. Inbuilt scroll in ListView, so no problem!
I suggest you to go with number #1 or #3. Using fragments you will have better control.
If you come to know any better idea, please share!
It's StaggeredGridView
You can find an implementation at https://github.com/bulletnoid/StaggeredGridView
It's possible using GridLayout. More details in the link.
http://developer.android.com/reference/android/widget/GridLayout.html

How to Create ListView like this? (Traffic Counter)

Good Morning All,
I am creating an application to display List of applications with their data usage.
I want my list to look similar to Traffic Counter Pro on android Market
I have also added the print-screen on my box.net as SOF does allow me to upload image
So Can someone direct me how to create ListView like this?
My second Question related to this how to create a tab style Activity.
Two examples that helped me a lot:
http://www.codemobiles.com/forum/viewtopic.php?t=876
and
http://android-developers.blogspot.com/2009/02/android-layout-tricks-1.html
i hope they are usefull to you.
You have to use custom ListView to embed images and format texts as given in the listview.
check out this example or this example or this example or even this example that gives you good understanding on listviews.
Good luck.
This is ListView which items consist of 4 Views objects, look through the tutorial of how to create ListViews and through the tutorial of how to create TabActivitys. And also use links suggested by #parag.
If you observe the screen shot carefully you can identify that group of these fields are available as list item.
They are
Application Icon
Application Name
Data Uploaded
Data Downloaded
Total Data Usage
So you have to create a layout with these fields as children with appropriate position and Use this custom layout as child layout for ListView.
I hope it may help you.

How add this non clickable line (see on picture) to ListView with multi text in row?

could someone help me how to add this selected line which you can see on picture to ListView (I mean lines as "General, Incoming calls, etc."). I have made ListView using a HashMap, but I don't know how to add this line to my ListView. I'll be very thankful if anybody help me.
Picture here: http://img11.imageshack.us/img11/1795/sc20111010202936.jpg
Can easily be done with preferences and is called a preference category here is a good tutorial on preferences
http://www.kaloer.com/android-preferences
The Desired List View can be achieved in two ways:
1.Creating a Section List View Click here for Help
2.You can use the text with that background image in your xml for infalter layout.
And make it visible and invisible accordingly of your categorization.
Hope this would help you and guide to right path

Categories

Resources