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
Related
I have a ListView over the whole screen of the application. To search for list items, I want an input field on the top of the ListView, but it should only become visible if the ListView is scrolled down (like the search field in the email application of the iPhone).
Because it is a ListView I can't create a cell with an input field (other field type like the other cells) in it.
I would be glad if someone can give a hint with which technic I can do it.
Thx.
I'd suppose to use material-design pattern with scrollable navigation bar. There is common template of an application for that purpose in Android Studio
I think you should have a look at SearchView widget :
https://developer.android.com/reference/android/widget/SearchView.html
You try using a SearchView with a ListView. Tutorial link :
http://www.coderzheaven.com/2013/06/01/create-searchview-filter-mode-listview-android/
If you want to hide this then probably make this action menu as invisible and invalidate the options menu and set the visibility true to make it visible on list scroll.
Add a layout above the listview to put in your search edit text (in a linear layout or a frame layout with padding for the list view).
Alternately you could use one of the Design Support Library components and it will be even more well integrated. Then call from your layout to filter the ListView adapter components, ideally with a text watcher or listener that is added to the edit text.
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?
I am working on a UI where I have a list view. Each row has 2 information. One is Product name and the other is product ID stacked one over other. So each row has 2 lines of data.
What i want to do with this:
Once a user clicks on each row, it will further expand and show one input and one spinner. So it is basically for putting in Quantity and unit of measure.
Please let me know if this is achievable and if I can refer to some example.
What I need is more like
Taskos To Do List | Task List
https://play.google.com/store/apps/details?id=com.taskos&hl=en
All i need is that the category will not be expandable. Only the items will be expandable. All i need is an example of such app and then I can take it forward.
I think it could be done... you would need to put the extra widgets in your row layout, populate them and hide them upon list creation, then in your onListItemCLick you could unhide them.
Note I have no idea if this would work, but it seems reasonable that it might and it's what I would try and do to achieve the goal.
listView cannot be expanded. however you can use an expandablelistView
But the kind of functionality you want cannot be done this way(I guess.).
You can use
registerForContextMenu("your list View");
to register your list view
onCreateContextMenu
for the kind of action you want to be performed in your case its dialog with EditText and Spinner to have input from user
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