Textview is a basic control in Android. It inherits from the view. Other controls, such as button, digitalclock, and edittext, are expanded by textview.
For more information (inherited from textview), see the android development documentation, for example:
The textview control inherits from the view and implements the onpredrawlistener interface.
Directly inherited from the texview control include: button, checkedtextview, digitalclock, and so on.
Indirectly inherited from textview include checkbox, radiobutton, togglebutton, and so on.
The properties of the controls in android can be set directly on the main control page or in the style. The following is an example of the settings:
<TextView android:id="@+id/tvShowInfo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="98dp" android:layout_marginTop="203dp" android:text="abc" android:textSize="24dp" android:textColor="#DBDB70"> </TextView>
I set the font size and color of textview text above. This can also be set through the style attribute:
<resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="AppTheme" parent="android:Theme.Light"/><item name="android:textColor">#DBDB70</item><item name="android:textSize">30dp</item></resources>
Then, add the style to the control page:
<TextView android:id="@+id/tvShowInfo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="98dp" android:layout_marginTop="203dp" android:text="come on" style="@style/AppTheme"> </TextView>
The following shows how to obtain the resolution of the android simulator and go to the code editing page:
// Set the style to the window to setcontentview (R. layout. activity_main); // Step 1: Find the control textview TV = (textview) findviewbyid (R. id. tvshowinfo); // the screen resolution displaymetrics dm = new displaymetrics (); getwindow (). getwindowmanager (). getdefadisplay display (). getmetrics (DM); int W = DM. widthpixels; // int H of the screen width = DM. heightpixels; // high screen TV. settext ("high:" + W + "width:" + H); // set it to the control.