android-listview

Android Navigation Drawer ListView Headers

£可爱£侵袭症+ 提交于 2019-12-04 13:02:36
I've made a navigation drawer in my app. Inside my navigation drawer is a ListView . It's a simple list view with text items. The Gmail android app has a ListView with headers. (source: phonedog.com ) As you can see, the words: INBOX, RECENT LABELS, ALL LABELS are headers. I would like to implement exactly those type of headers into my app. Is this feature an inbuilt android thing or do I have to create something custom. If yes then how. Let me know if you need any more info. Thanks in Advance. 来源: https://stackoverflow.com/questions/19341033/android-navigation-drawer-listview-headers

ListView: Prevent a view from recycling

删除回忆录丶 提交于 2019-12-04 13:01:24
问题 I have a ListView wich use recycled views. I'm trying to prevent a view from recycle. So I use setHasTransientState: android.support.v4.view.ViewCompatJB.setHasTransientState(View view, boolean hasTransientState) It works very well on Jellybean version but it doesn't do anything on Api < 16. Is there a way to make it work or there is different approach for pre Jellybean ? I found out how to set a RecyclerListener like @Daniel Chow suggested. listView.setRecyclerListener(new RecyclerListener()

RadioGroup buttons loosing it's state after listView scroll

一个人想着一个人 提交于 2019-12-04 12:56:06
I struggle with a common problem however I can't see the solution to it. What I'm trying to achieve is to display the list of questions (they come from parsed JSON) and radioGroup under each. I've manage to get questions list displayed. Now when I check the buttons and scroll down the list the upper buttons are loosing it state. I have followed and read about getView() and tryed different ways: stackoverflow.com/...how-to-handle-oncheckedchangelistener-for-a-radiogroup-in-a-custom-listview-adap and here: stackoverflow.com...android-how-to-make-radiogroup-work-correctly-in-a-listview I'm using

How to show Fixed Number of Rows in a listView

时间秒杀一切 提交于 2019-12-04 12:40:45
I want to display only 5 rows in a ListView and rest of them should be scrollable .So far i have tried this <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <EditText android:id="@+id/txtFilename" android:layout_width="375dp" android:layout_height="wrap_content" android:layout_margin="10dp" /> <ListView android:id="@+id/ListView01" android:layout_width="fill_parent" android:layout_height="wrap_content" android:scrollbarSize="2dp" android: /> <LinearLayout android

Android Download Multiple Files one after another and show progress in ListView

时光怂恿深爱的人放手 提交于 2019-12-04 12:40:26
The user can add any number of downloads, but download will start one after another i.e. next download will start only after the completion of present download. The user will navigate away from the activity showing download progress in order to add new downloads, and when new file to be downloaded is added, the application navigates back to the activity showing download progress, where it will show the progress of the download, previously added, and keep the presently added file as pending download. As soon as the downloading completes, pending download will start downloading. In this way the

listview count vs adapter count in android

筅森魡賤 提交于 2019-12-04 12:24:58
Why do listview.getChildCount() and adapter.getCount() return different values? I have an onScroll method and from within it, if I call the methods above, each return different values. Does anyone know why? ListView.getChildCount() returns the number of Views on the screen. Adapter s getCount() returns the total number of objects in your list. getChildCount() getCount() You might have 50 String s in say an ArrayAdapter but only 10 are drawn on the screen at the current moment so your ListView count will be 10 but your Adapter count will be 50. adapter.getCount() returns total objects count

How to add multiple header views in a ListView

試著忘記壹切 提交于 2019-12-04 12:07:23
问题 I've a custom adapter for my ListView I want to add project names as the headers to my work requests. Adding a single header works just fine but I'm not sure how to add multiple headers using addHeaderView . I don't understand where exactly to place setAdapter or is it supposed to be placed multiple times? This is my java code for a single header which works: mListView = (ListView)findViewById(R.id.dashboardList); View header1 = getLayoutInflater().inflate(R.layout.listview_header, null,

ListView empty if SimpleCursorAdapter closed()

丶灬走出姿态 提交于 2019-12-04 11:33:36
I have a problem understanding why is my ListActivity and its corresponding listView empty when I call close() method on cursor object? Let me explain myself a bit... I retreive some values from a DB and get the result in my cursor object. After that I create my SimpleCursorAdapter and bind column from db with a field in my listView . Works like a charm, but... If I call cursor.close() at the end of onCreate() method my listView is shown empty? If I log the values from cursor to LogCat they're there until calling cursor.close() and that makes perfect sense, but why is the listAdapter emptied

EditText in ListView is updated by onTextChanged when scrolling

爱⌒轻易说出口 提交于 2019-12-04 11:33:17
问题 I have been searching for an answer to this, but the solutions don't seem to work for me. I have a TextView and an EditText in a list item. I am trying to update the stored values for the EditTexts when the user edits them. @Override public View getView(int index, View convertView, ViewGroup parent) { ViewHolder holder = null; final int pos = index; if (convertView == null) { convertView = mInflater.inflate(R.layout.user_details_list_row, parent,false); holder = new ViewHolder(); holder

How to update the ListView of a Fragment from another Fragment?

我的梦境 提交于 2019-12-04 10:52:52
How can I communicate a listview of a ListFragment after an event of a Fragment inside another Fragment ? In the ListFragment (fragment A) I have a method to refresh the ListView . But also, I need to refresh it after a click of a Button inside a Fragment , wich is child of another Fragment (fragment b) Its like Fragment A (listFragment) | Fragment B (detailview) (fragment C - child fragment of B) How can I do it? You can access another Fragment by its tag : // find your fragment YourFragment f = (YourFragment) getSupportFragmentManager().findFragmentByTag("yourFragTag"); // update the list