My first question on SO so let me know if I phrase something wrong. Just like the title says, I wish the text within each item of my listview to stay on one row (if the are longer than what fits make them end with a "..." or something like it). I have a kind of a "recent searches" in my android app which leaves them all in an array of strings, I then display them in the listview like the following:
ListView recenlist = (ListView) findViewById(R.id.recentChatList);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, recCharArray);
recenlist.setAdapter(adapter);
recenlist.setTextFilterEnabled(true);
where recCharArray contains a bunch of strings that varry in size and are displayed in the listview. However, they should stay on one row but don't. Ive tried singleLine, maxLines but I can't get it to work. Any ideas?
and then in the XML:
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/recentChatList"
android:layout_below="@+id/searchField"
android:layout_alignParentStart="true"
android:layout_marginTop="45dp" />
I've been searching around a lot but I can't seem to find a solution that works for me, do I need a new approach to this? Do I need to change something completely?
Thanks in advance!