Note that there are some explanatory texts on larger screens.

plurals
  1. POGallery scroll invalidates whole view
    text
    copied!<p>I have a Gallery in my layout together with an ImageView and a few TextView widgets. Unfortunately I get low scroll performance for the Gallery on a slow phones. The problem disappears when I remove the background image from the LinearLayout containing ImageView and TextView. I overrrided the onDraw() for the whole view and checked the clip rect - it is always the whole screen. It looks like every time I scroll the gallery (and it is invalidated) the whole screen is invalidated. Is there any way to avoid full screen redraw when I only scroll the Gallery widget?</p> <p>Thanks </p> <pre><code>private class GalleryAdapter extends ArrayAdapter&lt;WeatherDisplayInfo&gt; { LayoutInflater mInflater; Context mContext; public GalleryAdapter(Context context) { super(context, R.layout.gallery_item_view, mForecastData); mContext = context; mInflater = LayoutInflater.from(context); } public int getCount() { return mForecastData.size(); } public WeatherDisplayInfo getItem(int position) { return mForecastData.get(position); } public long getItemId(int position) { return position; } private class ViewHolder { public TextView text_date; public TextView text_forecast; public TextView text_temperature; public TextView text_pressure; public TextView text_humidity; public TextView text_windspeed; public ImageView weather_image; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if(convertView == null) { if(position == getCount() - 1) { convertView = mInflater.inflate(R.layout.logo_view, null); holder = new ViewHolder(); // store view holder convertView.setTag(holder); } else { convertView = mInflater.inflate(R.layout.gallery_item_view, null); holder = new ViewHolder(); holder.text_date = (TextView) convertView.findViewById(R.id.text_date); holder.text_forecast = (TextView) convertView.findViewById(R.id.text_desc); holder.text_temperature = (TextView) convertView.findViewById(R.id.text_temp); holder.text_pressure = (TextView) convertView.findViewById(R.id.text_pressure); holder.text_humidity = (TextView) convertView.findViewById(R.id.text_humidity); holder.text_windspeed = (TextView) convertView.findViewById(R.id.text_wind); holder.weather_image = (ImageView) convertView.findViewById(R.id.image_weather_view);; // store view holder convertView.setTag(holder); convertView.setDrawingCacheEnabled(true); convertView.buildDrawingCache(); } } else { holder = (ViewHolder) convertView.getTag(); } // set view data return convertView; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload