0
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/darker_gray">

    <TextView
        android:text="VIP List"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#4CAF50"
        android:textSize="24sp" />

    <TextView
        android:text="Kunal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#4CAF50"
        android:textSize="24sp" />

    <TextView
        android:text="Kagure"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#4CAF50"
        android:textSize="24sp" />

    <TextView
        android:text="Lyla"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#4CAF50"
        android:textSize="24sp" />

</LinearLayout>

This is how a typical layout looks like in Android, so I see all the android: are redundant, I understand that the purpose of the namespace is disambiguate the elements, so is there a way if I just write text = "Name", it will be interpreted as android:text = "Name" by setting some global default perhaps?

gates
  • 4,465
  • 7
  • 32
  • 60

1 Answers1

0

android xml need this element (android:...) Because some libraries need to use (app:...), or even you create custom view and personal custom attribute for view.

you can see custom view by Defining custom attrs this link.

Rasoul Miri
  • 11,234
  • 1
  • 68
  • 78