android-flip icon indicating copy to clipboard operation
android-flip copied to clipboard

Can you demo flipview with some layout

Open hoangpn412 opened this issue 12 years ago • 3 comments

I'm using Flipview, and I have a question: in my adapter: I using 3 layout, example: public View getView(int pos, View convertView, ViewGroup parent) final View layout = convertView; if (convertView == null) { if (position == 0) { layout = inflater.inflate(R.layout.zone1, null); holder = new ViewHolder(); holder.zone_name = (TextView) layout .findViewById(R.id.zone_txt_name); } if (position == 1) { layout = inflater.inflate(R.layout.zone2, null); holder = new ViewHolder(); holder.zone_name = (TextView) layout .findViewById(R.id.zone_txt_name2); } if (position == 2) { layout = inflater.inflate(R.layout.zone3, null); holder = new ViewHolder(); holder.zone_name = (TextView) layout .findViewById(R.id.zone_txt_name3); } } else { holder = (ViewHolder) layout.getTag(); }

.....

But sometime I flip from layout to layout2, or layout to layout 3, the display layout is incorrect.

Can you demo flipview with 2, 3 or more layout with artchitecture difference!!!

hoangpn412 avatar Jan 29 '13 04:01 hoangpn412

I created a simple demo to address your issue, but I can't re-produce the problem. If you think it's caused by specific layouts, please try to submit a pull request to help me debug it.

openaphid avatar Jan 29 '13 13:01 openaphid

The problem is: If we don't check convertView == null, we can't cache getView() If we don't save "layout.findviewbyId(...)" to holder, function getView() willl run slowly, because it had excuted layout.findviewbyId(..) too many time. I have not any solution for its.

hoangpn412 avatar Jan 29 '13 17:01 hoangpn412

The best approach is to make FlipView support getViewTypeCount() and cache views according to their view types. But I'm afraid I'm not available to make it real in these days

openaphid avatar Feb 05 '13 03:02 openaphid