Questions tagged [listview]

A ListView is a graphical screen control or widget provided by UI libraries in a majority of modern operating systems to show items in a list form.

Although there are many types of ListView controls across platforms and operating-systems, generally it is considered to be a type of enhanced list control with support for features such as columns (and column headers) and per-item images.

The ListView control is used extensively in the Windows UI shell, providing the display surface for the Explorer's folder view, for example. The control itself is provided by the Common Controls library and can be used by any application to display data.

ListView controls are sometimes also called in some platforms. In others, such as GTK+ they are implemented as a kind of columnar TreeView.

Tag Usage:

51186 questions
155
votes
7 answers

android.content.res.Resources$NotFoundException: String resource ID #0x0

I'm developing an Android app which reads data from MySQL database and I faced this error. I have this XML layout:
user2881604
  • 2,030
  • 3
  • 18
  • 35
154
votes
7 answers

Android Recyclerview vs ListView with Viewholder

I recently came across the android RecyclerView which was released with Android 5.0 and it seems that RecyclerView is just an encapsulated traditional ListView with the ViewHolder pattern incorporated into it, which promotes the reuse of the view,…
Mushtaq Jameel
  • 6,933
  • 6
  • 30
  • 52
145
votes
5 answers

Android hide listview scrollbar?

Is there a way to hide scrollbar in ListView. I know it's possible for ScrollView but can't find a way for ListView scrollbar. Any ideas?
Android-Droid
  • 13,649
  • 37
  • 107
  • 184
141
votes
9 answers

How to handle ListView click in Android

How do I listen to click event on a ListView? This is what I have now ListView list = (ListView)findViewById(R.id.ListView01); ... list.setAdapter(adapter); When I do the following list.setOnItemSelectedListener(new…
teepusink
  • 23,746
  • 37
  • 103
  • 147
138
votes
11 answers

Showing empty view when ListView is empty

For some reason the empty view, a TextView in this case, always appears even when the ListView is not empty. I thought the ListView would automatically detect when to show the empty view.
Sheehan Alam
  • 57,155
  • 123
  • 348
  • 546
135
votes
13 answers

notifyDataSetChange not working from custom adapter

When I repopulate my ListView, I call a specific method from my Adapter. Problem: When I call updateReceiptsList from my Adapter, the data is refreshed, but my ListView doesn't reflect the change. Question: Why doesn't my ListView show the new data…
Jasper
  • 2,199
  • 4
  • 22
  • 38
132
votes
6 answers

Android List View Drag and Drop sort

I have a list of records in a listview that I want the user to be able to re-sort using a drag and drop method. I have seen this implemented in other apps, but I have not found a tutorial for it. It must be something that others need as well. Can…
miannelle
  • 2,181
  • 5
  • 19
  • 15
129
votes
4 answers

Android: Why does long click also trigger a normal click?

I have a ListView with listeners for a long click and a regular click. Why, when I long press a list item, the regular click event gets called too? I need to have two separate functions for the different clicks.
mellowg
  • 1,736
  • 3
  • 15
  • 19
127
votes
13 answers

WPF ListView turn off selection

Is it possible to turn off the selection of a WPF ListView, so when user clicks row, the row is not highlighted? I would like the row 1 to look just like row 0 when clicked. Possibly related: can I style the look of the hover / selection? Eg. to…
Martin Konicek
  • 33,336
  • 20
  • 82
  • 92
126
votes
10 answers

Recyclerview and handling different type of row inflation

I'm trying to work with the new RecyclerView, but I could not find an example of a RecyclerView with different types of rows/cardviews getting inflated. With ListView I override the getViewTypeCount and getItemViewType, for handling different types…
Lokkio
  • 1,653
  • 2
  • 16
  • 19
122
votes
5 answers

Android ListView headers

I have ListView that has some kind of events on it. Events are sorted by day, and I would like to have header with date on it for every day, and then events listen below. Here is how I populate that list: ArrayList crs = new…
Rohit Malish
  • 3,141
  • 12
  • 44
  • 66
121
votes
5 answers

setState() or markNeedsBuild called during build

class MyHome extends StatefulWidget { @override State createState() => new MyHomePage2(); } class MyHomePage2 extends State { List items = new List(); buildlist(String s) { setState(() { print("entered…
Divyang Shah
  • 1,510
  • 4
  • 10
  • 22
117
votes
22 answers

Get clicked item and its position in RecyclerView

I am replacing my ListView with RecyclerView, list showing ok, but I would like to know how to get clicked item and its position, similar to the method OnItemClickListener.onItemClick(AdapterView parent, View v, int position, long id) we use in…
Xcihnegn
  • 11,111
  • 10
  • 30
  • 32
112
votes
5 answers

Populating a ListView using an ArrayList?

My Android app needs to populate the ListView using the data from an ArrayList. I have trouble doing this. Can someone please help me with the code?
kAnNaN
  • 3,524
  • 4
  • 25
  • 39
111
votes
16 answers

Android draw a Horizontal line between views

I have My Layout like below:
String
  • 3,462
  • 9
  • 39
  • 63