Динамически передать значение Spider-Scrapy

Попробуйте следующее:

public static class ViewHolder {
    public ImageView imageView;
    public TextView textView; 

    public View getView(int position, View convertView, ViewGroup parent) {
        try{
            ViewHolder holder;

            if (convertView == null)  {
                holder = new ViewHolder(); 
                LayoutInflater inflater = context1.getLayoutInflater();
                convertView = inflater.inflate(R.layout.your_layout, null,true);  

                holder.imageView = (ImageView) convertView.findViewById(R.id.imgview);

                holder.textView = (TextView) convertView.findViewById(R.id.txtview);

                convertView.setTag(holder);  
            } else {
                holder = (ViewHolder) convertView.getTag();  
            }

            holder.textView.setText("your text");
            holder.imageView.setImageResource("your image resource");
        } catch (Exception e) {
            System.out.println("Error: "+e);    
        }

        return convertView;
    }
}
0
задан Sudarsanan 8 March 2019 в 01:07
поделиться