Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>LinearLayout ll = new LinearLayout(YourActivity.this); ll.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT)); ll.setBackgroundColor(Color.parseColor("#000000")); ll.setOrientation(LinearLayout.VERTICAL); ScrollView sv = new ScrollView(YourActivity.this); sv.setSmoothScrollingEnabled(true); TableLayout tl = new TableLayout(YourActivity.this); tl.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT)); tl.setStretchAllColumns(true); TextView header= new TextView(YourActivity.this); header.setText("This is heading "); header.setTextColor(Color.WHITE); header.setBackgroundColor(Color.parseColor("#323232")); header.setTextSize(17.0f); header.setGravity(Gravity.CENTER); header.setClickable(true); for(int sub = 0; sub &lt;=6; sub++) { // Six Rows will be genrated. TableRow tr = new TableRow(YourActivity.this); tr.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT)); if(sub != 0 ){ TextView col1 = new TextView(YourActivity.this); col1.setText("Column1"); col1.setTextSize(17.0f); col1.setPadding(5, 0, 0, 2); col1.setTextColor(Color.GRAY); col1.setGravity(Gravity.CENTER_VERTICAL); col1.setLayoutParams(new LayoutParams(50,50)); tr.addView(col1); TextView col2 = new TextView(YourActivity.this); col2.setText("Column2"); col2.setTextSize(17.0f); col2.setPadding(0, 2, 0, 2); col2.setTextColor(Color.GRAY); col2.setGravity(Gravity.CENTER_VERTICAL); col2.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,50)); tr.addView(col2); View v = new View(YourActivity.this); v.setBackgroundColor(Color.GRAY); v.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,1)); tl.addView(v); } tl.addView(tr);// add rows to the table. } TableRow row1 = new TableRow(Activity.this); // seventh row with //only one column ImageButton startButton = new ImageButton(YourActivity.this); startButton.setBackgroundColor(Color.TRANSPARENT); startButton.setImageResource(R.drawable.icon); startButton.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); row1.addView(startButton); row1.setGravity(Gravity.CENTER); tl.addView(row1); sv.addView(tl); //add table to scrollview to make it scrollable. ll.addView(header); // add heading to the LinearLayout ll.addView(sv); // add scrollview to LinearLayout setContentView(ll); enter code here </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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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