android-listview

Listview disable internal scrolling on Android

你说的曾经没有我的故事 提交于 2019-12-06 12:49:20
问题 I have a layout that I need to scroll in its entirety. The layout contains a listview a the bottom, which is causing some discord. Here's what's happening: So you can see that the bottom scrolls in its own little world, and I need to disable that so it grows and extends the entire layout for scrolling. I've tried encapsulating it all in a <scrollview><linearlayout>mystuff</linearlayout></scrollview> , to no avail. I've tried infinite combinations with "match_parent" and "wrap_content" layout

Android - ListView scrollig too slow

女生的网名这么多〃 提交于 2019-12-06 12:46:21
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) convertView.findViewById(R.id.app_icon); mViewHolder.title = (TextView) convertView.findViewById(R.id

Selector, in listview (swipe-listview) row, stays in state pressed after re-instanciating the adapter

大兔子大兔子 提交于 2019-12-06 11:58:33
问题 I have a listview and the row's layout has a child with the background set to the following selector : <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true"> <shape android:shape="rectangle"> <solid android:color="@color/pressed_panel" /> <corners android:radius="@dimen/rounded_panel_corners" /> </shape> </item> <item> <shape android:shape="rectangle"> <solid android:color="#ffffff" /> <corners android:radius="@dimen/rounded_panel_corners" />

android ListView Simple Adapter, item repeating

浪尽此生 提交于 2019-12-06 11:57:57
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 SimpleAdapter(this, itemList, android.R.layout.simple_list_item_2, new String[] {"song", "artist"}, new int[] {

Android listView unwanted space between header view

孤者浪人 提交于 2019-12-06 11:51:52
I'm adding 2 different views in my ListView header view but for some reason it create a 20dp space between those 2 views. How should I remove it? Thanks! Edit : The 2 views I add don't have any top/bottom padding or margins, I'm asking if there is any special "feature" in the ListView headerView about space/separator between views. Edit 2: it seems that the space between the view in my header view is tied to the dividerHeight parameter. Why? I mean it should only be applied as rows separator. Is there any way to remove it from my headerView and keep it as actual row separator ?

getting item's name when clicking a ListView

余生长醉 提交于 2019-12-06 11:26:44
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 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. You can use lv.getItemAtPosition(position) to get the text based on the index position lv.setOnItemClickListener(new

Can i use nested linearlayouts instead of list view, for a big list?

感情迁移 提交于 2019-12-06 11:05:01
问题 I am downloading a lot of images and text (Just like facebook posts) from server. So as the listview is scrolled it blinks while creating recycled views. So i want to use multiple linearlayouts for each of the post inside my main linear layout. In this case, Will there be any scrolling performance or memory consumption issue? Please help? 回答1: You should not use a bunch of LinearLayouts as a replacement for a ListView. ListViews do something called as View Recycling so that at any one time

Android change data in adapter

杀马特。学长 韩版系。学妹 提交于 2019-12-06 11:03:07
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(convertView); } private View newView(ViewGroup parent) { Log.w(Launchalot.this.getPackageName(),"newView

Does anyone know how to highlight a selected item in a Android listView?

南楼画角 提交于 2019-12-06 10:31:34
问题 I'm trying to create a listview where upon tapping an item the background changes color. So far my current implementation results in the "opposite" visible cell having its background changed. For example, if I chose the top item in the list, the bottom item is highlighted. Can anyone help me implement the desired functionality? My list Activity: public void onCreate(Bundle savedInstanceState) { Log.e(TAG, "Starting Symptom Activity..."); super.onCreate(savedInstanceState); setContentView(R

Listview, custom adapter and checkboxes

℡╲_俬逩灬. 提交于 2019-12-06 10:24:45
i got an issue with my adapter. Here is the code: @Override public View getView(final int position, final View convertView, final ViewGroup parent) { final ViewHolder viewHolder; View view = convertView; if (view == null) { view = LayoutInflater.from(mContext).inflate(R.layout.row, parent, false); viewHolder = new ViewHolder(); viewHolder.textTitle = (TextView) view.findViewById(R.id.title); viewHolder.checkBox = (CheckBox) view.findViewById(R.id.checkBox); viewHolder.checkBox.setTag(position); view.setTag(viewHolder); viewHolder.imageView = (ImageView) view.findViewById(R.id.activity