Dynamic Linear Layout - Partial code

  LinearLayout ll = new LinearLayout(this);
  ll.setOrientation(android.widget.LinearLayout.VERTICAL);
  ll.setBackgroundColor(0xAA000000);
    
  LinearLayout.LayoutParams params1 = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,  
           LayoutParams.WRAP_CONTENT);  
  params1.topMargin = 2;
        
  TextView tv = new TextView(this);
  tv.setLayoutParams(params1);       
  tv.setText("Sample Text");
  tv.setTextColor (Color.WHITE);
  tv.setPadding(10, 10, 10, 10);
  ll.addView(tv);  

  setContentView (ll);