简体   繁体   English

android listview滚动问题

[英]android listview scrolling issue

I have an application that have a Custom ListView, in the list i have 1 button and 1 textview, the button has two backgroud images one is play and the other one is pause, when you click play it changes to pause image, but when you scrolling down and get back to the one that you pressed it returns to play image. 我有一个具有自定义ListView的应用程序,在列表中我有1个按钮和1个textview,该按钮有两个背景图像,一个是播放的,另一个是暂停的,当您单击播放时,它将变为暂停图像,但是当您向下滚动并返回到您按下的位置即可返回播放图像。

any help please 任何帮助请

我认为您应该尝试使用ViewHolder可能会对您有所帮助

In your getView() method, determine which image should be shown and set it on the button 在您的getView()方法中,确定应显示哪个图像并将其设置在按钮上

public View getView(int position, View convertView, ViewGroup viewGroup) {
    Entry entry = mList.get(position);

    // Generate the layout row

    if(entry.isPlaying()){  
    // set pause icon as background
    } else{
         // set play icon
    }

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM