Im creating an in app chat and I cant figure out how to keep the listview I have implemented to keep from growing down below the edittext box I set up to take user chat. Whats happening now is that new lines add to the listview just fine but after the list grows large enough it starts to add to itself below the edittext box. I find that pretty annoying and imagine a user would too so my question is:
How can I keep a listview from growing downwards.
Id like for new fields/text to add to the bottom of the listview but be placed ontop of the edittext just like any normal chat would do.
It's very easy, simply set the transcriptMode. If you do it from XML, you have the choice between normal and alwaysScroll:
http://developer.android.com/reference/android/widget/AbsListView.html#attr_android:transcriptMode
This is how the built-in Google Talk and SMS/MMS applications are implemented (they use the normal transcript mode.)
Related
Hi I am developing an android app and I want to add a similar component that I found in another app this is the structure:
So I want to make something like this but I can't figure out what components of xml android to use I was thinking of a CardView with a ListView inside or use a table layout instead but I dont know if that's the right choice because it has to be dynamic, when I tap the + button I have to add a new row or when I tap the - the last row has to disappear also the weight and reps elements are text field's for the user to input data. What's the best way to achieve this?
My Android app displays a huge text file as a simple scroll-able page.
Currently I use a TextView embedded within a ScrollView, and it is terribly slow since the whole TextView is loaded into memory at once although only a small fraction of the text is visible at any given time.
I realize that it is possible to use a ListViewand build an adapter to load only parts of the text, but that also feels like a sub-optimal hack since I do not want to see any visible borders or unwanted line breaks between such list items.
Is there any easy way to display a huge text file, maybe a library?
I'm developing an application and I am facing a problem using ExpandableListView. What I'm trying to do is, in GroupHeader, not only show the group name, but also an spinner with options. That's because I want to show the football second division games in the list but, also, give the option to choose the round, in case the user wants to check older/future games. SO far I have that
As you can see both, title and spinner, shows. Also you can see the arrow on the right which is supposed to expand the list. Problem is that, if I click, only spinner opens, group expand button doesn't. So, here is my question, how can I make both of them work depending on where you click (one or another)??? Is that possible?
Also I must say that if I only place the TextView with the group name works perfect. If I only place the spinner, the problem persists. So I'm guessing that's a focus problem.
Btw: grey areas are the layout backgrounds, so no, they are not hiding behind the button.
I found the solution, I just neede to add this line android:descendantFocusability="blocksDescendants" to the Main Layout of the xml where I define the GroupHeader elements.
I dread designing UI for Android apps, and I have been searching and trying every possible combination of things to get this the way I want it, but I just cannot seem to get it right.
I want to have a simple Android app that has a text field and a send button next to each other on the bottom of the screen (I already have this correct), and I also want a functional chat area filling the rest of the screen above.
It obviously needs to be scrollable, and I would like to be able to add a new line to the bottom of the chat by doing something like chatBox.add(username, text).
This is the type of view I am looking for:
<bob> my name is bob
<bill> hi bob, my name is bill!
<bob> we are having an awesome conversation, bill
<bill> both of our names start with a b
<bob> how right you are
I had made such app. For chat window I used listView. ListView has stackFromBottom mode. So the last added messages will be on the bottom of ListView. Also I created custom Adapter extending ArrayAdapter, so it is easy to add new messages.
Here is a nice example, how to use listView with adapter and add new items.
Leonisdos is right, you shoud use listView. Do you know the app Irssi-ConnectBot ? I think you should have a look in its source code to have many good examples.
Here the code.google project of Irssi-connectbot (and the github)
Wrap a TextView in a ScrollView. Use append() on the TextView and fullScroll(View.FOCUS_DOWN) on the ScrollView when you append new chat entries.
For longer chats, Leonidos' ListView approach is more efficient, but I thought I'd mention this one.
Goal: have a LIstView show a list of text strings. The user can select an item by touching it. The selected item is visibly different to those not selected.
In short I want to have a simple scrolling list box that works using trackballs AND touch mode.
There are many posts asking for this, but none seem to get an adequate answer. This is such a simple requirement, why is there no article on this?
I looked at http://developer.android.com/resources/tutorials/views/hello-listview.html but that won't work in touch mode: the orange background is displayed, something unachievable in touch mode without extreme geek wizadry, for something that is quite frankly what all newbies expect out of the box.
I suspect that the only way to achive a touch mode selectable listbox (ListView in google speak), is to stick radio buttons in there. All of a sudden my little text list view is beccoming a monster.
Can anyone explain the simplest way to do a single choice ListView that displays the item selected so the user can figure out that it is selected, in touch mode? After fumbling for days, I really am not fussed if it has radio buttons, singing cockatoos, or whatever, so long as it's simple to code.
Here's the example that Google provides:
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List10.html
It uses radio buttons
Wat do u want to do? Just highlighting the row in the ListView which is selected.rt? for this u can use this.
android:listSelector="#drawable/highlighter"
android:drawSelectorOnTop="true"
Write this code in your XML file