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.
52,681
questions
3168
votes
54
answers
828k
views
How to stop EditText from gaining focus when an activity starts in Android?
I have an Activity in Android, with two elements:
EditText
ListView
When my Activity starts, the EditText immediately has the input focus (flashing cursor). I don't want any control to have input ...
2080
votes
41
answers
578k
views
How to lazy load images in ListView in Android
I am using a ListView to display some images and captions associated with those images. I am getting the images from the Internet. Is there a way to lazy load images so while the text displays, the UI ...
483
votes
18
answers
280k
views
How to implement Android Pull-to-Refresh
In Android applications such as Twitter (official app), when you encounter a ListView, you can pull it down (and it will bounce back when released) to refresh the content.
I wonder what is the best ...
431
votes
14
answers
204k
views
How do I remove lines between ListViews on Android?
I'm using two ListViews like this:
<ListView
android:id="@+id/ListView"
android:text="@string/Website"
android:layout_height="30px"
android:layout_width="150px"
android:scrollbars="...
431
votes
12
answers
91k
views
Background ListView becomes black when scrolling
I have created a specific List which exists out of the following elements to create a scrollable list with every row containing a Image on the left side and some text on the right side:
To begin with ...
408
votes
20
answers
280k
views
How to add a ListView to a Column in Flutter?
I'm trying to construct a simple login page for my Flutter app. I've successfully built the TextFields and log in/Sign in buttons. I want to add a horizontal ListView. When I run the code my ...
381
votes
36
answers
292k
views
How to implement endless list with RecyclerView?
I would like to change ListView to RecyclerView. I want to use the onScroll of the OnScrollListener in RecyclerView to determine if a user scrolled to the end of the list.
How do I know if a user ...
357
votes
15
answers
279k
views
RecyclerView vs. ListView
From android developer (Creating Lists and Cards):
The RecyclerView widget is a more advanced and flexible version of
ListView.
Okay, it sounds cool, but when I saw this example picture, I got ...
356
votes
6
answers
206k
views
Android ListView with different layouts for each row
I am trying to determine the best way to have a single ListView that contains different layouts for each row. I know how to create a custom row + custom array adapter to support a custom row for the ...
356
votes
1
answer
19k
views
List view getListItemXmlAttributes method fails with child publication items
I have created a JS class to populate SG/Folder list view data, when items are modified. (As per Jaime's approach)
Everything works great when I operate on items in the publication they're created in.
...
346
votes
7
answers
629k
views
How do you dynamically add elements to a ListView on Android?
Can anyone explain or suggest a tutorial to dynamically create a ListView in android?
Here are my requirements:
I should be able to dynamically add new elements by pressing a button.
Should be simple ...
329
votes
12
answers
291k
views
setState() or markNeedsBuild called during build
class MyHome extends StatefulWidget {
@override
State<StatefulWidget> createState() => new MyHomePage2();
}
class MyHomePage2 extends State<MyHome> {
List items = new List();
...
329
votes
1
answer
123k
views
ListBox vs. ListView - how to choose for data binding
I'm considering either a ListBox or a ListView for a WPF application. It seems either supports data binding and item templates. My application has a simple list of items that I intend to be able to ...
310
votes
16
answers
231k
views
How to show an empty view with a RecyclerView?
I am used to put an special view inside the layout file as described in the ListActivity documentation to be displayed when there is no data. This view has the id "android:id/empty".
<TextView
...
299
votes
9
answers
231k
views
Listview Scroll to the end of the list after updating the list
I would like to make sure that the list is scrolled all the way to the bottom, after I have updated the listview by using listAdapter, so that it displays the last element entered in the list. How ...
253
votes
2
answers
122k
views
How to Get a Layout Inflater Given a Context?
I am writing a custom implementation of a ListAdapter.
In its constructor, I'm taking in a Context, a resource ID (i.e. R.id.xxx representing the layout file), and a list and a map (these contain the ...
252
votes
25
answers
141k
views
OnItemCLickListener not working in listview
Activity class code:
conversationList = (ListView)findViewById(android.R.id.list);
ConversationArrayAdapter conversationArrayAdapter=new ConversationArrayAdapter(this, R.layout....
241
votes
5
answers
81k
views
Should we use RecyclerView to replace ListView? [closed]
Android Docs say:
The RecyclerView widget is a more advanced and flexible version of
ListView. This widget is a container for displaying large data sets
that can be scrolled very efficiently by ...
239
votes
13
answers
421k
views
Custom Adapter for List View
I want to create a custom adapter for my list view. Is there any article that can walk me through how to create one and also explain how it works?
237
votes
10
answers
118k
views
Android Endless List
How can I create a list where when you reach the end of the list I am notified so I can load more items?
229
votes
3
answers
53k
views
How does setting baselineAligned to false improve performance in LinearLayout?
I was just building some UI in xml, and Lint gave me a warning and said to set android:baselineAligned to false to improve performance in ListView.
The docs for the Lint changes that added this ...
220
votes
19
answers
318k
views
Horizontal ListView in Android?
Is it possible to make the ListView horizontally? I have done this using a gallery view, but the selected item comes to the center of the screen automatically. I don't want the selected item at the ...
218
votes
14
answers
113k
views
How to Animate Addition or Removal of Android ListView Rows
In iOS, there is a very easy and powerful facility to animate the addition and removal of UITableView rows, here's a clip from a youtube video showing the default animation. Note how the surrounding ...
202
votes
25
answers
138k
views
Android, ListView IllegalStateException: "The content of the adapter has changed but ListView did not receive a notification"
What I want to do: run a background thread which calculates ListView contents and update ListView partially, while results are calculated.
What I know I have to avoid: I cannot mess with ListAdapter ...
196
votes
4
answers
278k
views
Flutter: filter list as per some condition
I'm having a list of movies. That contains all animated and non-animated movies. To identify whether it's Animated or not there is one flag called isAnimated.
I want to show only Animated movies. How ...
195
votes
23
answers
239k
views
Flutter: Scrolling to a widget in ListView
How can I scroll to a special widget in a ListView?
For instance I want to scroll automatically to some Container in the ListView if I press a specific button.
ListView(children: <Widget>[
...
186
votes
8
answers
223k
views
Android: ListView elements with multiple clickable buttons
I've a ListView where every element in the list contains a TextView and two different Buttons. Something like this:
ListView
--------------------
[Text]
[Button 1][Button 2]
--------------------
[...
185
votes
4
answers
33k
views
ArrayIndexOutOfBoundsException with custom Android Adapter for multiple views in ListView
I am attempting to create a custom Adapter for my ListView since each item in the list can have a different view (a link, toggle, or radio group), but when I try to run the Activity that uses the ...
184
votes
8
answers
114k
views
How can I make a horizontal ListView in Android? [duplicate]
Possible Duplicate:
Horizontal ListView in Android?
Like many things in Android, you wouldn't think this would be such a hard problem but ohhh, by golly, would you be wrong. And, like many ...
180
votes
18
answers
194k
views
How to scroll to top of long ScrollView layout?
For part of my app, the user is presented with a list of names and is asked to group them as they see fit.
(Note, the ListView code was copied verbatim from the Android Views tutorial. I haven't ...
173
votes
9
answers
141k
views
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:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http:...
169
votes
12
answers
86k
views
custom listview adapter getView method being called multiple times, and in no coherent order
I have a custom list adapter:
class ResultsListAdapter extends ArrayAdapter<RecordItem> {
in the overridden 'getView' method I do a print to check what position is and whether it is a ...
164
votes
27
answers
232k
views
ListView inside ScrollView is not scrolling on Android
I am having trouble with a scrolling ListView inside a ScrollView. I have an Activity which has some EditTexts in the top part and then a tab host with two tabs which have one ListView each. When the ...
160
votes
3
answers
92k
views
How to dynamically update a ListView on Android [closed]
On Android, how can I a ListView that filters based on user input, where the items shown are updated dynamically based on the TextView value?
I'm looking for something like this:
-------------------...
157
votes
6
answers
161k
views
Flutter: ListView disable scrolling with touchscreen
Is it possible to let a ListView only be scrollable with the ScrollController and not with the touchscreen?
156
votes
7
answers
104k
views
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 ...
152
votes
14
answers
207k
views
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.
...
146
votes
5
answers
92k
views
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?
141
votes
9
answers
244k
views
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....
140
votes
11
answers
165k
views
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.
<...
138
votes
15
answers
136k
views
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?
(source: konim5am at artax.karlin.mff.cuni.cz)
I would like the row 1 to look just ...
135
votes
12
answers
106k
views
Flutter: Minimum height on horizontal list view
I'm trying to create a horizontal scrolling list of items in Flutter, and I want that list to only take up the necessary height based on its children. By design “ListView tries to expand to fit the ...
134
votes
4
answers
51k
views
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 ...
134
votes
7
answers
110k
views
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 ...
132
votes
19
answers
352k
views
Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `ListView`
I built an app with ReactNative both for iOS and android with a ListView. When populating the listview with a valid datasource, the following warning is printed at the bottom of the screen:
Warning:...
128
votes
10
answers
123k
views
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 ...
125
votes
19
answers
220k
views
Android draw a Horizontal line between views
I have My Layout like below:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
...
125
votes
22
answers
300k
views
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 ...
122
votes
5
answers
135k
views
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 ...
120
votes
12
answers
121k
views
Flutter : How to add a Header Row to a ListView
Very new to Flutter. I've been able to utilize HTTP requests for data, build a ListView, edit a Row in that List and other basics. Excellent environment.
I've managed to cobble together a badly ...