开发者

How do i convert this to XML layout format?

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);

}


<LinearLayout android:orientation="vertical>
    <TextView android:width="wrap_content  android:height="wrap_content/>
    <ScrollView>
        <LinerLayout android:orientation="vertical> 
        </LinearLayout>
    </ScrollView>
</LinearLayout>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜