This is the code comming from the Activity file. I would like to have the layout looks the same but i want that code in XML format. Because it’s so damn disturbing to have some code in dynamically and some in XML files. So please can someone make this from dynamically to xml layout?
protected void initLayout() {
// root view - GRN
LinearLayout rootView = new LinearLayout(this.getApplicationContext());
rootView.setOrientation(LinearLayout.VERTICAL);
this.mText = new TextView(this.getApplicationContext());
this.mText.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
rootView.addView(this.mText);
this.eventLayout = new LinearLayout(this.getApplicationContext());
this.eventLayout.setOrientation(LinearLayout.VERTICAL);
ScrollView sv_obj = new ScrollView(this.getApplicationContext());
sv_obj.addView(this.eventLayout);
rootView.addView(sv_obj);
this.setContentView(rootView);
}
1 Answer