android-listview

EditText and ListView are not working together

限于喜欢 提交于 2019-12-08 03:15:39
问题 I am having a weird problem where I have added an EditText inside a ListView and it is not clickable. When I do setFocusable:true in the EditText xml it is working but then the ListView items are not clickable. I have tried using android:descendantFocusability="afterDescendants" , blockDescendants and beforDescendants , but I read that these solutions works only for TextView and checkbox. Can somebody help to make both the things work together. Thanks in advance. 来源: https://stackoverflow.com

Android ListView ContextMenu

拥有回忆 提交于 2019-12-08 03:10:11
问题 I'm trying to create a ContextMenu when user tap hold on an item in my ListView . However my code doesn't show anything when I tap hold on my item. Could somebody please check on my code. Thank you. public class MyD extends SherlockListFragment implements ActionBar.TabListener { private File file; private List<String> myList; private Fragment mFragment; private ListView DLListView; private ArrayAdapter<String> listAdapter; @Override public void onActivityCreated(Bundle savedInstanceState) {

getting item's name when clicking a ListView

社会主义新天地 提交于 2019-12-08 02:39:45
问题 Is there any way I can capture a name of an item clicked in a list view when using "onItemLongClickListiner" ? I know I can capture position etc but I need a name 回答1: I suppose that you ListView is filled up with String object: public boolean onItemLongClick (AdapterView<?> parent, View view, int position, long id) { String name = (String) parent.getItemAtPosition(position); } AdapterView.getItemAtPosition(position) gets the data associated with the specified position in the list. 回答2: You

Android - ListView scrollig too slow

五迷三道 提交于 2019-12-08 02:37:39
问题 I have a ListView that has one image and two lines of texts for each element (organized by a RelativeLayout ). It works ok, but it's too slow and I know where the problem comes from! This is the getView() method for the custom adapter that I'm using: public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = mLayoutInflater.inflate(R.layout.list_view_item, parent, false); mViewHolder = new ViewHolder(); mViewHolder.cover = (ImageView)

android ListView Simple Adapter, item repeating

不羁的心 提交于 2019-12-08 02:23:50
问题 I created a custom ListView and in java filled that ListView with a SimpleAdapter . Here's my code: setContentView(R.layout.activity_my); list = (ListView) findViewById(R.id.lvList); itemList = new ArrayList<HashMap<String, String>>(); itemMap = new HashMap<String, String>(); for (int i = 0; i < songs.length; i++) { itemMap.put("song", songs[i]); itemMap.put("artist", artists[i]); System.out.println(songs[i] + " " + artists[i]); itemList.add(itemMap); } SimpleAdapter adapter = new

Android ListView listSelector not working

不想你离开。 提交于 2019-12-08 01:57:28
问题 I am trying to set a custom selector to a ListView. It's working fine on newer devices but not working on lower version of devices.I want the ListView selected item to be stay highlighted. Please help. Thanks in advance. ListView.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <ListView android:id="@+id/listViewBell"

Use CustomAdapter to change how ListView is displayed

♀尐吖头ヾ 提交于 2019-12-08 01:36:23
问题 My XML that I would like to use for custom adapter: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity

Android - How can diplay pictures in a simpleApapter list view

空扰寡人 提交于 2019-12-08 01:08:47
问题 I'm trying to display te pictures in a SimpleAdapter listview. I included Picasso in my project but i don't know how to use Picasso with a SimpleAdapter. List<HashMap<String, String>> featured = new ArrayList<HashMap<String, String>>(); for (int i=0;i<ids.length;i++){ HashMap<String, String> hm = new HashMap<String, String>(); hm.put("productname", names[i]); hm.put("productprice", prices[i]); hm.put("productimage", images[i]); featured.add(hm); } String[] from = {"productname", "productprice

How to combine an imageview with some text in listview

时光怂恿深爱的人放手 提交于 2019-12-08 00:35:23
问题 So far I've been using a simple ArrayAdapter to display some items in a ListView . Now I also want to display images alongside the text in the ListView . I have an AsyncTask called DownloadImageTask to download images. The downloading is working perfectly, but I don't know how to display an image in the ListView and how to use the DownloadImageTask to download the images in the ListView . This is the DownloadImageTask I use to download images into an ImageView : private class

Android change data in adapter

≡放荡痞女 提交于 2019-12-07 23:11:55
问题 I use this adapter for my ListView: Appadapter extends ArrayAdapter<ResolveInfo> private PackageManager pm=null; List<ResolveInfo> apps; AppAdapter(PackageManager pm, List<ResolveInfo> apps) { super(Launchalot.this, R.layout.row, apps); this.apps=apps; this.pm=pm; } @Override public View getView(int position, View convertView, ViewGroup parent) { Log.w(Launchalot.this.getPackageName(),"getView"); if (convertView==null) { convertView=newView(parent); } bindView(position, convertView); return