<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world"
android:id="@+id/myTextView" />
TextView myTextView = (TextView)findViewById(R.id.myTextView);
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world"
android:id="@+id/myTextView" />
TextView myTextView = (TextView)findViewById(R.id.myTextView);
转载于:https://my.oschina.net/Sadhu/blog/374218