In the daily development process, some pages tend to be small, we need to show some information, this time we viagra fast reading, we need to be in the code to draw the page, that is, by encoding the way to achieve the layout. <pre name= "code" class= "java" >linearlayout linearlayout = new LinearLayout (this);
TextView tv=new TextView (this);
Linearlayout.addview (TV);
Import Android.support.v7.app.actionbaractivity;import Android.os.bundle;import android.widget.LinearLayout; Import Android.widget.textview;public class Writelayoutactivity extends actionbaractivity {@Overrideprotected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); LinearLayout linearlayout = new LinearLayout (this); This.setcontentview (LinearLayout); TextView tv=new TextView (this); Tv.settext ("Dsadasdasdasda"); Linearlayout.addview (TV);}}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Android Development dynamically create layout files and controls