Layout and control are add from xml file and java file. In most application you can
add controls dynamically . so let the fun began....
// setting Layout dynamically..........
ScrollView sv = new ScrollView(this);
LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.VERTICAL);
sv.addView(ll);
// setting image view layout dynamically
ImageView iv=new ImageView(this);
iv.setImageResource(R.drawable.android_logo); // path of resourses
// add Image view to layout
ll.addView(iv);
// add layout to project
this.setContentView(sv);
0 Comments