Menu
TextView in Android Example
// Set text for text view
//XML
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Android Aura"/>
//JAVA
TextView tv = findViewById(R.id.tv);
tv.setText("Android Aura");
//Set Text Size
// XML
<TextView android:id="@+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:text="Android Aura"/>
// JAVA
TextView tv = findViewById(R.id.tv);
tv.setText("Android Aura");
tv.setTextSize(22);
//Set Text Color
//XML
android:textColor="#1C83EA"
android:textColor="@color/colorAccent"
//JAVA
tv.setTextColor(Color.BLUE);
tv.setTextColor(Color.parseColor("#00abd7"));
//styles.xml
//<item name="colorAccent">@color/colorAccent</item>
tv.setTextColor(getResources().getColor(R.color.colorAccent));
// Text Background Color
//XML
android:background="#F7DC6F"
//JAVA
tv.setBackgroundColor(Color.parseColor("#F7DC6F"));
// Text all CAPS
//XML
android:textAllCaps="true"
//JAVA
tv.setAllCaps(true);
// Text Font Family
//XML
android:fontFamily="sans-serif"
// Font Style
//XML
android:textStyle="bold"
android:textStyle="italic"
android:textStyle="normal"
//JAVA
tv.setTypeface(Typeface.DEFAULT_BOLD);