0

I am learning how to develop using MVVM. I created a small example as shown below in the code. my question is about xmlns: in some tutorials they used xmlns:bind while in other xmlns:tools was used.

please let me know th edifference and when to be used.

xml

<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:bind="http://schemas.android.com/tools">

<data>
    <!-- the class the behaves as Viewmodel and contains the @Bindable Object-->
    <variable
        name="vm1"
        type="com.example.amrbakri.mvvm_02.LoginViewModel1" />
</data>


<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <TextView
        android:id="@+id/actMain_LoginViewModel1_tv_results"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:visibility="visible"
        android:text="@{vm1.result}"
        />
</LinearLayout>
</layout>
user10776303
  • 241
  • 6
  • 16
  • 1
    both are same if they point to the same things. you can name anything. for tools attribute reference check out: https://developer.android.com/studio/write/tool-attributes – Shubham AgaRwal Jan 05 '19 at 11:21
  • 1
    Possible duplicate of [What does "xmlns" in XML mean?](https://stackoverflow.com/questions/1181888/what-does-xmlns-in-xml-mean) – Shubham AgaRwal Jan 05 '19 at 11:22

0 Answers0