Listview selects the first item by default. Click to change the subitem background image. The listview background image

Source: Internet
Author: User

Listview selects the first item by default. Click to change the subitem background image. The listview background image

(It's not a great god. There aren't hundreds of sub-projects. You can't do it)
Private int last_item_position; @ Override public void onItemClick (AdapterView <?> Arg0, View view, int position, long arg3) {// cancel merging mTts. stopSpeaking (); isSpeaking = 0; PoiList poiList = poiListList. get (position); List <String> lStrings = poiList. poiContent; search_word_title.setText (poiList. poiName); TV _place.setText (poiList. poiSpotName); String contentUri = lStrings. get (0); downLoadContent (contentUri); ImageView imageView = (ImageView) view. findViewById (R. id. search_listview_item_img); last_item_position = position; adapter. policydatasetchanged ();} public class SearchAdapter extends ArrayAdapter <GetResultFromPOIName. poiList> {private int resourceId; private ImageView imageView; public SearchAdapter (Context context, int textViewResourceId, List <GetResultFromPOIName. poiList> objects) {super (context, textViewResourceId, objects); resourceId = textViewResourceId;} @ Override public View getView (int position, View convertView, ViewGroup parent) {PoiList poiList = getItem (position); TextView newsTitleText = (TextView) convertView. findViewById (R. id. news_title); imageView = (ImageView) convertView. findViewById (R. id. search_listview_item_img); imageView. setBackgroundResource (R. drawable. image_floor_gary); if (last_item_position = position) {imageView. setBackgroundResource (R. drawable. image_floor_color);} else {imageView. setBackgroundResource (R. drawable. image_floor_gary);} return convertView ;}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.