Note that there are some explanatory texts on larger screens.

plurals
  1. PODistribution of images into Columns
    primarykey
    data
    text
    <p>This may be a pretty simple problem but am not finding any solution for it. My requirement is something like this. The number of images and number of rows given, the images should get distributed in the rows equally. Which I am doing it.. But now the problem lies in the worst case scenario: Ex. if i have given total number of images as 99 and total number of rows as 50, then in the 49 rows the columns should be 2 with an image each and in the 50th column there should be only one image in one column. I am not able to find a way to resolve this proble. Please do help me out. Am posting the code here. Please help me. Thanks in advance. </p> <pre><code> @Override protected void onPreExecute() { HSC = new HorizontalScrollView(getApplicationContext()); VSC = new ScrollView(getApplicationContext()); tableLayout = new TableLayout(getApplicationContext()); tableLayout.setGravity(Gravity.CENTER); } @Override protected Void doInBackground(Void... params) { runOnUiThread(new Runnable() { public void run() { int a =0; for (Integer row = 0; row &lt; rows; row++) { //Rows are being plotted. tableRow = new TableRow(getApplicationContext()); for (Integer col = 0; col &lt; img; col++) { /*Images shared into number of columns. Column=img/rows*/ image = new ImageView(getApplicationContext()); android.view.animation.Animation anim = animate(a); /*android.view.animation.Animation anim = AnimationUtils .loadAnimation(getApplicationContext(), R.anim.fadein);*/ image.startAnimation(anim); image.setPadding(20, 20, 20, 20); image.setImageResource(R.drawable.images); tableRow.addView(image); a++; } tableLayout.addView(tableRow); } VSC.addView(tableLayout); HSC.addView(VSC); setContentView(HSC); } }); return null; } @Override protected void onPostExecute(Void result) { super.onPostExecute(result); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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