title: ListView with 3 columns - Android
body: <p>I want to create <code>ListView</code> with 3 columns (all 3 columns will be the same). So one column is one <code>ImageView</code>. For populating the <code>ListView</code> I have an array with images.</p>
  
  <p>Design should be like this:
  <img src="https://i.stack.imgur.com/gaa6X.png" alt="Layout"></p>
  
  <p>To populate ListView I need custom Adapter and custom Layout. Layout is only 3 images with id-s:
  <code>ivImage1</code>, <code>ivImage2</code>, <code>ivImage3</code></p>
  
  <p>My custom adapter:</p>
  
  <pre><code>public class Adapter extends BaseAdapter {
  
      private int[] gallery = {
              R.drawable.cat_321_sofa,
              R.drawable.cat_corner_sofa,
              R.drawable.cat_beds,
              R.drawable.cat_arm_chairs,
              R.drawable.cat_puff,
              R.drawable.cat_coffe_table,
              R.drawable.cat_day_night,
      };
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
  
          View row;
  
          if (convertView == null) {
              LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              row = inflater.inflate(R.layout.one_gallery_layout, parent, false);
          } else {
              row = convertView;
          }
  
          ImageView ivImage1 = (ImageView) row.findViewById(R.id.ivImage1);
          ImageView ivImage2 = (ImageView) row.findViewById(R.id.ivImage2);
          ImageView ivImage3 = (ImageView) row.findViewById(R.id.ivImage3);
  
          ivImage1.setImageResource(); ??????
          ivImage2.setImageResource(); ??????
          ivImage3.setImageResource(); ??????
  
          return row;
      }
  
      @Override
      public int getCount() {
          return ????????????
      }
  
      @Override
      public Object getItem(int position) {
          return 0;
      }
  
      @Override
      public long getItemId(int position) {
          return 0;
      }
  }
  </code></pre>
  
  <p>So the problem is the size of <code>ListView</code>, the return of getCount(); , and putting image on every <code>ImageView</code></p>
  
  <p>How can I do this, or there is some other solution for this problem.....</p>