android-flip
android-flip copied to clipboard
Can you demo flipview with some layout
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!!!
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.
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.
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