1

在我的应用程序中,我使用的是适配器。我击中了这里。实际上我需要将xml/filename.xml显示如下。

我想显示如下代码。

我已经手动完成了,但是有没有像我们所说的布局这样的方法。 xml >layout> filename.xml它显示

如何将这样的编码写入 xml 文件到 res/xml/..?

<cursor-adapter xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res/com.example.android.xmladapters"
      app:uri="content://com.android.contacts/contacts"
      app:selection="has_phone_number=1"
      app:layout="@layout/contact_item">

      <bind app:from="display_name" app:to="@id/name" app:as="string" />
      <bind app:from="starred" app:to="@id/star" app:as="drawable">
            <map app:fromValue="0" app:toValue="@android:drawable/star_big_off" />
            <map app:fromValue="1" app:toValue="@android:drawable/star_big_on" />
      </bind>
      <bind app:from="_id" app:to="@id/name" app:as="com.example.android.xmladapters.ContactPhotoBinder" />

    </cursor-adapter>
4

0 回答 0