为什么我们应该在变量<variable type =“ list&lt; DetailedUser” name =“”>中写入List和DetailedUser

时间:2019-06-17 10:58:33

标签: android-databinding

我不明白代码的这一行为什么我们有list和DetailedUser?

<data>
     //app class
 <import type = "com.androidistanbul.databindingdemo.layoutdetails.DetailedUser/>
 // java class
  <import type= "java.util.List"/>
 <variable 
    name = "userList"
    type = "detailedUser" /> // import class
<variable 
    name="userList"
    type = "list&lt;DetailedUser" />
 </data> 

// List index
 <TextView 
//   android:layout_midth = "wrap_content"
//   android:layout_height= "wrap_content" 
//   android:layout_marginTop = "8dp"
  android:text="@{userList[index].name +  "" + userList[index].surnane}"/>

1 个答案:

答案 0 :(得分:0)

&lt;&gt;html entities,它们分别代表<>

所以List&lt;DetailedUser&gt;转换为List<DetailedUser>