I would like this type of interface in my android application:
This interface can be displayed several times in the same activity.
I'm confused on how I should proceed. Do I have a listview with different custom item?
Is it even possible to do this with xml layout ?
I know how to use custom items in Listview, but i don't know how to do this item. Or have to use a gridview?
Related
I have a ImageView with a TextView and Button. I have it currently in a custom list view, but I noticed now that I don't need to show more as one element (object). So I actually don't need a Listview to show the row (list entry). How can I show the list entry without a Listview?
You can put the elements of your custom listview item into a Layout, e.g. LinearLayout and simply add it to your activity's layout where you needed it.
You can set an OnClickListener for that layout, so user can click the whole thing.
I think you should use ListActivity. Then you can set up empty view for list. Here some tutorial: ListActivity and ListView Tips.
Also you can implement that logic with Recycler view by yourself or use library.
Here is solution from stackoverflow
I want to have an expandable menu, and when you expand a child item, then it will show some custom items, items of my choice, like a text input field or a checkbox (see the image below).
Now how can I achieve that? Can I achieve that using the Eclipse GUI builder? Or do I have to create methods where the data is loaded dynamically?
UPDATE:
So I do not only want text items as child elements, but all sorts of elements, like an input field or checkbox.
This tutorial works like charm
http://myandroidsolutions.blogspot.in/2012/08/android-expandable-list-example.html
i also took code from here to make my custom expandable UI by implementing adapter
I am trying to have a layout with 6 TextViews and a Custom List.
TextView number 3,4,5 have images next to them,followed by the Custom List.
The custom list is done , but I am not sure how I can get the upper part ( TextView controls and images ) and the custom list in one layout.
For other custom lists I have always extended from ListActivity and set the list adapter in the same class as it is the only control on the screen.
In this case the class extends from Activity,how can I set the list adapter in the Activity class ?
Any pointer's to achieve this layout and which layout will be the optimal choice(Linear,Relative..) ?
Thanks,
Salil.
I found the answer to my problem.
Add a listview to the layout xml
Get the listview object using findViewById
User etAdapter to set the custom list adapter
Now I can use the custom list along with other controls in the same Activity.
Thanks,
Salil.
I have created one list view.. it is having 5 items...
Now I want split the list items...
when user clickon the first listitem or focus on first item then immediately it has to show followed some text views or other things..but it has to show same list..
and agian same when he clickon or focus on the second item that first item has to be close and second item has to act some thing....
I think you need to implement the concept of "Expandable Listview", so that the clicking on one item, it will be expanded with their sub-items.
Refer the android-sdk page of Expandable ListView: http://developer.android.com/reference/android/widget/ExpandableListView.html
For having an example, check this site: http://mylifewithandroid.blogspot.com/2008/05/expandable-lists.html
Pls, check the below image, do you want to perform as same ????
If you want to do the same, it is already given in the "API-Demos" at Views/Expandable Lists/1. Custom Adapter.
Enjoy !!
The problem is that you cannot use the standard ListView in your case, because in the standard ListView, the View of each row has to be one TextView.
In your case, you need it to be at least two TextViews (The standard Text, and the one that's gonna show up onClick/onFocus).
You have to create your custom ListAdapter, and override the getView() function.
Here is a code snippet that shows how to do it properly:
Custom Adapter
In the getView(), you have to inflate the XML file that describes your List Row, and return it.
In your case, I believe your XML file should contain 2 TextViews, one visible and one invisible.
Then, to handle the clicks, you can set a onItemClickListener on your ListView in your Activity class.
The best way may be to have your Activity class implementing onItemClickListener, and to use this onItemClickListener to handle those.
In the onClick() function, you just have to set the Visibility of your hidden TextView to VISIBLE.
You need to build custom rows, and handle showing more text on each row, there is no easy magicall way of doing it, but inflating your own rows, and setting a couple of attributes visibility isnt all that hard either.
I wish to work with checked list views wherein only one item can be selected at a time. Some queries related to this:
Is it advised to work with CheckedTextView as the ListView items, or a combination of CheckBox and TextView?
If using CheckedTextView, the text comes first and the checkbox appears on the right edge. Is it possible to make the checkbox appear on the left of the TextView?
How can I make one of the items as checked in onCreate()?
Note: I am using array adapter and calling setAdapter() to populate list.
You need to extend ArrayAdapter and use LayoutInflater to inflate the row layout as you need. This way you have full flexibility in list creation.
Please check this example, where basic idea is described:
Custom list view