ViewFlipper in ListView row

↘锁芯ラ 提交于 2019-12-01 13:44:57

Managed to get it working now, the code is

public View getView(int position, View convertView, ViewGroup parent) {

    final ViewFlipper flipperTemp;

    if (convertView == null) {
        convertView = mLayoutInflater.inflate(mLayout, null);

        viewHolder = new ViewHolder();
        viewHolder.flipper = (ViewFlipper) convertView.findViewById(R.id.viewConfFlipper1);
        viewHolder.flipper.setDisplayedChild(0);
        viewHolder.v2FieldName = (TextView) convertView.findViewById(R.id.tvLongName);
        viewHolder.button01 = (ImageButton) convertView.findViewById(R.id.imageButton1);    
        convertView.setTag(viewHolder);

    } else {
        viewHolder = (ViewHolder) convertView.getTag();
        viewHolder.flipper.setDisplayedChild(0);
    }


    flipperTemp = (ViewFlipper) convertView.findViewById(R.id.viewConfFlipper1);

    viewHolder.v2FieldName.setText(items.get(position).get("name"));        
    viewHolder.button01.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            flipperTemp.showNext();
        }
    });

    return convertView;
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!