android-listview

Select All items of a ListView (custom row with checkbox in it)

隐身守侯 提交于 2019-12-21 03:34:22
问题 What I have: I have a ListView with custom rows, having a CheckBox & two TextViews in each row. I have a button for "Select All". What i want: I want that when I click the button, all the CheckBox in ListView get checked/unchecked. What is the problem: In OnClick of the "Select All" button. i am doing this: public void OnClickSelectAllButton(View view) { ListView l = getListView(); int count = l.getCount(); for(int i=0; i<count; ++i) { ViewGroup row = (ViewGroup)l.getChildAt(i); CheckBox

Tap to refresh is visible all the time and gap is still visible on list view

泪湿孤枕 提交于 2019-12-21 03:02:53
问题 I am using pull to refresh in my application. Pull to refresh is working fine when the list size is crossing screen. But when the size is one or two there is a gap between the header and the listview saying tap to refresh. Here is my code public class PullToRefreshListView extends ListView implements OnScrollListener { private static final int TAP_TO_REFRESH = 1; private static final int PULL_TO_REFRESH = 2; private static final int RELEASE_TO_REFRESH = 3; private static final int REFRESHING

Is using AsyncTask still recommended for loading listView items in the background?

随声附和 提交于 2019-12-21 02:28:36
问题 Background I've heard that there are some new solutions for loading data in the background which are more recommended than AsyncTask (like loaders). The problem AsyncTasks are great and easy to use. However, it has some limitations: The class itself has to be modified since it's limited by the number of pending tasks (about 256 or so). Of course, in a listView's adapter, I always cancel a task if it's not needed(for example when I need to update a view that was used for a different item). I

FragmentPagerAdapter getItem error with ListFragment

狂风中的少年 提交于 2019-12-21 02:03:26
问题 I've looked at quite a lot of code and can't figure this out. http://developer.android.com/reference/android/support/v4/app/FragmentPagerAdapter.html It has to be something simple. I'm showing most of the code. The error is in the next section. public class MainActivity extends FragmentActivity implements ActionBar.TabListener { public static final int TAB_COUNT = 3; public static InputMethodManager inputManager; SectionsPagerAdapter mSectionsPagerAdapter; ViewPager mViewPager; @Override

How to make TextWatcher wait for some time before doing some action

别来无恙 提交于 2019-12-20 21:46:11
问题 I have an EditText to filter the items in the ListView below it, which may contain more than 1000 items usually. The TextWatcher is: txt_itemSearch.addTextChangedListener(new TextWatcher() { public void onTextChanged(CharSequence s, int start, int before, int count) { fillItemList(); } public void afterTextChanged(Editable s) { } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } }); The issue here is that with each letter typed by the user, the list is getting

ListView is not showing correct values after scrolling

▼魔方 西西 提交于 2019-12-20 14:44:05
问题 In my application I am using a CustomListView with an ArrayAdapter to show different countries time. But after 6 to 7 rows(depending on the phone screen size) the time values are repeating. According to some previous post I have written the following code snippet to get the solution. But the problem is still there. Following is the code I have written: public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; Order o = items.get(position); if (v == null) {

Hiding ListView Header / Hiding Single Divider in a List

*爱你&永不变心* 提交于 2019-12-20 11:54:11
问题 I found this Hide footer view in ListView?. As Yoni poited out correctly, you can hide a header in a ListView by wrapping it into a FrameLayout and setVisibility() of the inner View to View.GONE . This works almost perfect for me, BUT: As the FrameLayout still exists, the ListView adds two dividers to the displayed list. It seems like a single divider with a height of two dividers. Is there a way to hide a single divider of a ListView ? Maybe it's possible to change the divider's color to the

Advanced android layout: making a ListView divider from a layer-list

天大地大妈咪最大 提交于 2019-12-20 10:57:34
问题 Refer to the image below to understand what I'm trying to do. It should be obvious from the image provided. It seems like this should be pretty simple. The question is, why is the tiled middle section offset by an inconsistent amount for each list entry? product_list.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="fill_parent"> <ListView android:id="@+id/android:list" android:layout_width="wrap_content"

Is it possible to extend AbsListView to make new ListView implementations?

倖福魔咒の 提交于 2019-12-20 10:15:25
问题 I've been looking at creating a stylistically different list view, like many other people, and I started by looking to extend AbsListView. Per the Android doc, AbsListView is: Base class that can be used to implement virtualized lists of items. A list does not have a spatial definition here. For instance, subclases of this class can display the content of the list in a grid, in a carousel, as stack, etc. After some effort and review of the ListView implementation, it looks like it may not be

assigning hidden values to a listview item

别说谁变了你拦得住时间么 提交于 2019-12-20 10:09:17
问题 I have an activity that extends ListView. I populate my list with the results of a query to the sqlite database. A list element consists of start_time, end_time, client_name and status. These are the 4 bits on info I need to display for each list item. My question is: Is it possible for me to assign hidden elements to this ListView item? For example, I want to store the _id field of the database row for that ListView item, so that when I click it I can start a new activity based on data for