Note that there are some explanatory texts on larger screens.

plurals
  1. POShow to ScrollView in one LinearLayout
    primarykey
    data
    text
    <p>I want to show two scrollView in one LinearLayout or RelativeLayout. Which property should is set to show first Scrollview on the top of screen and second scrollview just below the first Scrollview ?</p> <p>I have tried but in linearlayout it shows me only first scrollview and in relativelayout it shows me only second scrollView.</p> <p>Yes, I want to do all this dynamically without using xml file.</p> <p>Here is my code</p> <pre><code>import android.app.Activity; import android.os.Bundle; import android.widget.*; import android.widget.TableLayout.LayoutParams; public class TableFinal extends Activity { LinearLayout linearMain, linearScrollView, linearTextview; RelativeLayout relativeMain; ScrollView scrollview; HorizontalScrollView Hscrollview; TableLayout tablelayout; TableRow tablerow; TextView textview; LinearLayout.LayoutParams linearparmas; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); linearparmas=new LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT); relativeMain = new RelativeLayout(this); // First Table linearScrollView = new LinearLayout(this); scrollview = new ScrollView(this); Hscrollview = new HorizontalScrollView(this); tablelayout = new TableLayout(this); // First Table's First Row tablerow = new TableRow(this); linearTextview = new LinearLayout(this); textview = new TextView(this); textview.setText("11"); linearTextview.addView(textview); tablerow.addView(linearTextview); linearTextview = new LinearLayout(this); textview = new TextView(this); textview.setText("12"); linearTextview.addView(textview); tablerow.addView(linearTextview); tablelayout.addView(tablerow); Hscrollview.addView(tablelayout); scrollview.addView(Hscrollview); linearScrollView.addView(scrollview); relativeMain.addView(linearScrollView); // first table complete // second tabler start linearScrollView = new LinearLayout(this); scrollview = new ScrollView(this); Hscrollview = new HorizontalScrollView(this); tablelayout = new TableLayout(this); // second Table's First Row tablerow = new TableRow(this); linearTextview = new LinearLayout(this); textview = new TextView(this); textview.setText("21"); linearTextview.addView(textview); tablerow.addView(linearTextview); linearTextview = new LinearLayout(this); textview = new TextView(this); textview.setText("22"); linearTextview.addView(textview); tablerow.addView(linearTextview); tablelayout.addView(tablerow); Hscrollview.addView(tablelayout); scrollview.addView(Hscrollview); linearScrollView.addView(scrollview); relativeMain.addView(linearScrollView); // second tabler complete setContentView(relativeMain); } } </code></pre> <p>Thank you.</p>
    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