The introduction of Android User Interface (UI) TextView

Android TextView (Source Google)

TextView  display text to the user and optionally allow them to edit it. TextView is a complete text editor.

This is stated in the class as below:

TextView textview = (TextView) findViewById(R.id.texty);

Several Important Attributes TextView in layout:

  • android: id = This is the ID that uniquely identifies the control.
  • android: text = Show Text
  • android: textcolor = coloration text
  • android: text textsize = text size

Android TextView allows you to display text in android application. Here is an example.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="16dp"
    android:orientation="vertical">
 
    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text=“Free Android – java – Kotlin Lessons"
        android:textAppearance="?android:attr/textAppearanceSmall" />
 
    <TextView
        android:id="@+id/textView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="16dp"
        android:layout_marginTop="16dp"
        android:text=“Learn Android App Development"
        android:textAppearance="?android:attr/textAppearanceMedium" />
 
    <TextView
        android:id="@+id/textView5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text=“Master Android App"
        android:textAppearance="?android:attr/textAppearanceLarge" />
    
    <TextView
        android:id="@+id/textView8"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="16dp"
        android:layout_marginTop="16dp"
        android:text=“Master Android App in Red"
        android:textColor="#ba0404"
        android:textSize="24dp" />
 </LinearLayout>

Special font

You can define your own custom fonts for strings in your application. You only need to download the required font from the Internet, and place it in the folder assets / fonts.

1. Add File Font.TTF.

Adding Font Files

2. typing code syntax and declarations.

Declare Code Syntax

3. Results.

Results Special Font

Source: Master Android (App)

Post Author: Study