Android dynamic array of imageviews in relative layout 3 per row
<p>Well,  I would like to seek your help regarding how to show imageviews dynamically 3 per row in relative layout. What I tried so far is I am able to show imageviews one below other because of which I can add maximum 10 images in screen.
            Instead I want to add 3 images per row.<br>
Here is my source code:</p>

<pre><code>        int prevTextViewId = 0;
    for(int i = 0; i &lt; 1; i++)
                {
                    {
                        final TextView textView = new TextView(context);
                        textView.setText(savedListCont[K]);
                        textView.setCompoundDrawablesRelativeWithIntrinsicBounds(null, bd,null , null);
                        textView.setPadding(0, 20, 0, 20);
                        textView.setTextColor(Color.WHITE);
                        textView.setMaxLines(1);
                        textView.setEllipsize(TextUtils.TruncateAt.MIDDLE);
                        int curTextViewId = prevTextViewId + 1;
                        textView.setId(curTextViewId);

                        final RelativeLayout.LayoutParams params =
                                new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
                                        RelativeLayout.LayoutParams.WRAP_CONTENT);

                        params.addRule(RelativeLayout.BELOW, prevTextViewId);
                        textView.setLayoutParams(params);

                        prevTextViewId = curTextViewId;

    ll.addView(textView, params);
</code></pre>

<p>Actually, I can use <code>gridview</code> or <code>gridlayout</code> for same but these both doesn't suit my project requirement.</p>

<pre><code>My layout:
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;RelativeLayout  xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/home_one"
    android:layout_width="match_parent"
    android:layout_height="match_parent"&gt;

&lt;/RelativeLayout&gt;  
</code></pre>

<p>Thanks &amp; Regards,
Aditya.J</p>