android-listview

highlight listview item

若如初见. 提交于 2019-12-06 03:38:57
I need to highlight a listview item when i touch it and to stay highlighted. I tried everything I found but nothing worked. Here is my code: This is the listview: <ListView android:id="@+id/lvUsers" android:layout_width="300dp" android:layout_height="fill_parent" android:layout_alignParentLeft="true" android:background="@drawable/border2" android:choiceMode="singleChoice" android:padding="5dp" > </ListView> The @drawable/border2 is just a border around the listview. This is the listview item layout: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id

Android ShareActionProvider with popup menu - undesired duplicate list

孤人 提交于 2019-12-06 03:34:50
Okay this is a pretty specific one: My ShareActionProvider is being used on posts in a forum. It works (apart from pesky facebook but I understand that is a well-known issue). However, when I select the share option from my pop-up menu, two lists are drawn, one on top of the other. How can I fix it so only one list is displayed? Edit: At least two other questions exist on SO referring to this problem: I Use ShareActionProvider in PopupMenu, but show two PopupMenu? Call ShareActionProvider from a PopupMenu Here is my code: Menu item in xml <item android:id="@+id/menu_community_overflow_share"

Is there a way to share a same LayoutManager between multiple nested RecyclerViews

ⅰ亾dé卋堺 提交于 2019-12-06 03:29:26
问题 I'm developing an application that showing a game list, inside every game's itemView, i also have a video list to be showing. preview and structure are following. I deploy a RecyclerView as the window root view, and then for the videos, i used grid-style RecyclerView to display, so here we got a nested RecyclerView structure. But there is trouble because the number of videos is inconsistent between games, i don't want the RecyclerView of video list able to being scroll, so the best way is

How to fix notifyDataSetChanged/ListView problems in dynamic Adapter wrapper Android

非 Y 不嫁゛ 提交于 2019-12-06 03:27:38
问题 Summary: Trying to dynamically add heading rows to a ListView via a custom adapter wrapper. ListView is having trouble keeping the scroll position in sync. Runnable demo project provided. I would like to dynamically add items to a list based on the values in a CursorAdapter, several positions ahead of what the user is currently viewing. To do this, I have an adapter that wraps the CursorAdapter and keeps the new content indexed in a SparseArray. The ListView needs to be updated when items are

MvxListView checkable list item

北城余情 提交于 2019-12-06 03:26:36
I wanted to get the CustomChoiceList to work with MvvmCross, but was struggling getting the sample working, the ListItem wouldn't get selected. In fact the sample uses a custom LinearLayout that extends LinearLayout and implements ICheckable. When using the same layout with a MvxAdapter and an MvxListView the method OnCreateDrawableState is never called and the text and selection icon are never high-lighted. I'm aware that the selected item could be stored in the ViewModel. Here is the original sample: https://github.com/xamarin/monodroid-samples/tree/master/CustomChoiceList In fact the

Android convertView, to use it or not?

岁酱吖の 提交于 2019-12-06 03:24:13
问题 In the article Multithreading For Performance from Android Developer Blog, convertView is used in Adapter.getItem() to display a list of ImageView , which are downloaded through HttpRequest.Yet, I also see some Android tutorials that don't use the convertView , and just inflate a new view in Adapter.getItem() . I'm wondering what's the advantage of using convertView ? How does it recycle the used view? Where are the used view cached? I ask this question because I didn't use convertView in my

change listview item background when clicke

醉酒当歌 提交于 2019-12-06 03:10:34
I have a listview and i want to when i click on a row, its background changes to blue. i use this code: listView1.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // TODO Auto-generated method stub parent.getChildAt(position).setBackgroundColor(Color.BLUE); } }); this works wit some wrong. when i click on first item, it turns to blue but item #3 and #5 changes to blue too!!! i cant understand why!! i just want only selected item turns to blue!!! What about to use selectors? They works properly and provide

Android Displaying FullScreen Slider Images

依然范特西╮ 提交于 2019-12-06 02:59:32
I have a gridviewImages dispalyed on Android screen. My Requirement is to Slide the FullScreen Images Here My code: ImageAdapter : public class ImageAdapter extends BaseAdapter { private Context mContext; // Constructor public ImageAdapter(Context c) { mContext = c; } public int getCount() { return mThumbIds.length; } public Object getItem(int position) { return null; } public long getItemId(int position) { return 0; } // create a new ImageView for each item referenced by the Adapter public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView; if (convertView ==

ArrayAdapter and ListView - ArrayIndexOutOfBoundsException

Deadly 提交于 2019-12-06 02:58:43
问题 I'm really hoping someone can help me out with this one. I've been stuck on it forever. Occasionally, when someone is using my app, it'll force close with this exception: java.lang.ArrayIndexOutOfBoundsException at android.widget.AbsListView$RecycleBin.addScrapView(AbsListView.java:3572) at android.widget.AbsListView.trackMotionScroll(AbsListView.java:2487) at android.widget.AbsListView.onTouchEvent(AbsListView.java:2001) at android.widget.ListView.onTouchEvent(ListView.java:3234) at android

ListView with longClick for showing and hiding Checkbox?

拜拜、爱过 提交于 2019-12-06 02:53:53
问题 I read along the code here (weblink). And the code has been modified a little bit to become like this: FileArrayAdapter.java public class FileArrayAdapter extends ArrayAdapter<Item> { private Context c; private int id; private List<Item> items; public FileArrayAdapter(Context context, int textViewResourceId, List<Item> objects) { super(context, textViewResourceId, objects); c = context; id = textViewResourceId; items = objects; } public Item getItem(int i) { return items.get(i); } @Override