LinearLayout linearLayout=new LinearLayout(MyActivity.this); TextView tv=new TextView(MyActivity.this); LinearLayout.LayoutParams layoutParams=new LinearLayout.LayoutParams(100,50); linearLayout.addView(tv,layoutParams);