Dynamic UI ListView - android-layout

If I have a xml file linear layout with CheckBox, TextView and ImageView and want this to display as scrollable list, having different name and different pictures in every rom of ListView , how can I do it. I am really confused, can you please help me understand. Thank you.

What you're trying to achieve is a custom list row. There are plenty of examples around:
http://appfulcrum.com/?p=311
http://www.softwarepassion.com/android-series-custom-listview-items-and-adapters/

Related

How to display search results in groups like whatsapp does

I have a viewpager with some tabs. I always use the same fragment with a listview to load some String data into the listview. So far, so good. I now want to implement a searchview. And, I want to group the search results like whatsapp does. So the found listview items should be grouped by the tabs they were found in.
My question is: Which view does whatsapp use and how can I do so ?
Can I keep my simple listview or do I need some other stuff ? I thought about an expandable Listview, could this be a solution ?
Unfortunately, SO doesn't allow me to post an WA screenshot at this moment. But I think you know what I mean.
At the end of this day, I can say that my desired Grouping of Searchresults is definitely possible with an Expandable Listview.
You can hide the Group indicator and disable collapse so it looks like in whatsapp.

UICollectionView custom layouts

Hi I am beginning iOS development, and was playing around with UICollectionView. I was just wondering how you could achieve this type of layout. As shown below:
The idea is to have like a main news article in the big cell. Just confused how I am suppose to get two cells in the 2nd column. Much appreciated!
Create custom class which will act as layout for your collection view. This class will child class for UICollectionViewFlowLayout.
Then you can override below two methods and can create your own custom layout as you want.
- (NSArray*)layoutAttributesForElementsInRect:(CGRect)rect
- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)path
UICollectionViewLayoutAttributes is class which will deal with cell position, frame, Zindex etc
You can also use below properties.
collectionView:layout:minimumInteritemSpacingForSectionAtIndex:
collectionView:layout:minimumLineSpacingForSectionAtIndex:

Android UI Best Practices for Display Field turning into Input Field

I'm programming an android app with a list displaying images and some additional information like title, place, etc...
I'm new to the android ecosystem and wondering what are the best practices to implement a list element which normally displays the mentioned information and turns into input fields on a press on the listelement.
Do I have to draw the display elements (e.g. TextField) and the edit element on top of each other and set visible for either display or input? How to handle this generally? Or do I replace the layout responsible for the list element altogether?
I know that for the simple case of a text there is a simple solution for making the EditText field look like an uneditable TextField. I'm, however, looking for a general answer covering broader cases than just a TextField.
Thanks!
you can make the elements of the listview a view flipper having two views.one you textview and other and edittext.
<ViewFlipper
...
<TextView
... />
<EditText
... />
/ViewFlipper>
Then in the onItemClickListener of the list items you can call flipper.showNext();
So, flipper works like, it shows only the first view defined in it and on the subsequent call of showNext() it displays the next view defined in it.
So if you have 2 elements in it, it will behave as the coin with two sides.
So in your situation there are a few ways you can achieve this.
First way is to build a layout which contains TextView and EditText and in first initialization your edit text won't be visible. And in your OnItemClick you have to hide your textview and show editext with value of your current data and option to edit.
The second way which I think is more user friendly is that you can show an AlertDialog after OnItemClick with custom layout where you can change the values and update the listview after user press Yes or do nothing is he selects No.
It depends on you which way you will do that, but I think the second option is the better one.

List view inside scroll view design

I have a UI design which should contain a text data and this can be dynamic so i need a scroll view after the TextView is over i need a list view, Now this list view onItemClick of a cell should expand and contract to show details, Any sample project or code from where i can achieve this UI design, Please help me with this one.
It is strongly not recommended to have Nested Views that scroll.
What you can do is have a TextView followed by the ListView. You can use expandable listView for your expansion requirement. All the examples are present in APIDemos shipped with Android SDK.
Try some of the stuff and get back for more help here.

Create Form in J2ME

I want to design one form that contains TextField and ListView in J2ME. But I don't know how to create this form. It is looked like Dictionary Form. Could anybody help me to do that?
You can't really do that with the basic UI controls in MIDP.
List can't contain TextField.
I would suggest looking at LWUIT since it has better controls.
Otherwise, if you don't need to display Images in your List, then you can use a Form containing both TextField and StringItem. Unfortunately, an ItemStateListener added to the Form will probably not give you as much information as a List.
Implementing the list yourself in a CustomItem means writing quite a bit of code but is doable.
If what you need is a TextField where you enter a search String and a List that displays the search result, I suggest using a TextBox first, then a List. Separate screens are by far the quickest solution here.
Edit: you can't use swing in j2me. what you can do is have just a textfield in a form, then add/remove StringItems to/from the Form when the user changes the content of the TextField. You should be able to rely on ItemStateListener to tell you when the textfield content changes.

Resources