title: android frame layout with horizontal scroll bar and ovelapped images
body: <p>i want to create a Frame layout to place a number of images from database, which need to be a horizontal  scrollable list. Image Views are creating dynamically based on database value. Images must be overlapped like the attachment . Here is my xml </p>
  
  <pre><code> &lt;HorizontalScrollView
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:fillViewport="true" 
                  android:layout_marginTop="20dp"
                  &gt;
  
              &lt;FrameLayout
                  android:id="@+id/frmLayout"
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:scrollbars="horizontal"
                  android:layout_weight="1"
                   &gt;
  
              &lt;/FrameLayout&gt;
  
          &lt;/HorizontalScrollView&gt;
  </code></pre>
  
  <p>and Here is java</p>
  
  <pre><code>public void getAllImages(){
  
          cursorImages = dbAdapter.fetchImages();
          if (cursorImages.moveToFirst()) {
             BitmapFactory.Options options=new BitmapFactory.Options();
          options.inSampleSize = 2;
          do {
              String filename = cursorImages.getString(cursorImages
                      .getColumnIndex("filename"));
              try {
                  InputStream ims = getAssets().open("images/" + filename);
                  Bitmap bm = BitmapFactory.decodeStream(ims,null,options);
                  Matrix mat = new Matrix();
                  mat.postRotate(30);
                  Bitmap bMapRotate = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(), bm.getHeight(), mat, true);
                   ImageView im = new ImageView (this);
                   im.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));  
                   im.setImageBitmap(bMapRotate);
                   frmLayout.addView(im,new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT));       
              } catch (IOException ex) {
  
              }
          } while (cursorImages.moveToNext());
  
      }
      cursorImages.close();
  
   }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/VnLxe.png" alt="Screen 1">
  <img src="https://i.stack.imgur.com/U6Ewc.png" alt="SCreen 2"></p>