Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Try it:-</p> <pre><code>&lt;RelativeLayout android:layout_width="250dip" android:layout_centerHorizontal="true" android:layout_marginTop="30dip" android:layout_height="wrap_content" android:id="@+id/mRlayoutPopImages"&gt; &lt;TextView android:layout_width="wrap_content" android:id="@+id/mTxtViewPopularImages" android:layout_height="wrap_content" android:text="What's populars" android:layout_alignParentLeft="true" android:textStyle="bold" /&gt; &lt;HorizontalScrollView android:layout_width="fill_parent" android:layout_marginTop="10dip" android:layout_height="wrap_content" android:id="@+id/mHoScView" android:layout_below="@+id/mTxtViewPopularImages"&gt; &lt;LinearLayout android:layout_width="fill_parent" android:orientation="horizontal" android:layout_height="wrap_content" android:id="@+id/mLlayoutPopImages" /&gt; &lt;/HorizontalScrollView&gt; &lt;/RelativeLayout&gt; </code></pre> <p>Put Below Code in Your Java File:-</p> <pre><code>ImageView mImgview; int[] mImageArray = { R.drawable.blue, R.drawable.sunset, R.drawable.water, R.drawable.winter, R.drawable.blue }; LinearLayout mLlayoutPopImages; LinearLayout.LayoutParams params; </code></pre> <p>Write Following Code in onCreate Method:-</p> <pre><code>mLlayoutPopImages = (LinearLayout) findViewById(R.id.mLlayoutPopImages); params = new LinearLayout.LayoutParams(72, 72); params.leftMargin=10; params.rightMargin=10; for (int i = 0; i &lt; mImageArray.length; i++) { mImgview = new ImageView(this); mImgview.setLayoutParams(params); mImgview.setImageResource(mImageArray[i]); mLlayoutPopImages.addView(mImgview); } </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