我想要將DragnDrop listview從這裏的https://github.com/commonsguy/cwac-touchlist轉換爲C#與Mono for Android。MonoDroid如何在佈局axml文件中使用自定義屬性?
這個自定義視圖的一部分要求使用聲明一些自定義屬性的文件資源/價值/ attrs.xml內的以下內容:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="TouchListView">
<attr name="normal_height" format="dimension" />
<attr name="expanded_height" format="dimension" />
<attr name="grabber" format="reference" />
<attr name="dragndrop_background" format="color" />
<attr name="remove_mode">
<enum name="none" value="-1" />
<enum name="fling" value="0" />
<enum name="slide" value="1" />
<enum name="slideRight" value="1" />
<enum name="slideLeft" value="2" />
</attr>
</declare-styleable>
</resources>
然後我嘗試使用它們我的佈局文件中像這樣:
<app.monodroid.TouchListView xmlns:tlv="http://schemas.android.com/apk/res/app.monodroid"
android:id="@+id/lstExercises"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/lExerciseActions"
android:drawSelectorOnTop="false"
tlv:normal_height="64dip"
tlv:grabber="@+id/icon"
tlv:remove_mode="slideRight"
/>
但是當我嘗試建立項目中,我得到了以下錯誤消息:
/Library/Frameworks/Mono.framework/External/xbuild/Novell/Novell.MonoDroid.Common.targets: Error: Tool exited with code: 1. Output: /Users/path_to_project/App.MonoDroid/obj/Debug/res/layout/add_session.axml:1: error: No resource identifier found for attribute 'normal_height' in package 'com.app.monodroid' /Users/path_to_project/App.MonoDroid/obj/Debug/res/layout/add_session.axml:1: error: No resource identifier found for attribute 'grabber' in package 'com.app.monodroid' /Users/path_to_project/App.MonoDroid/obj/Debug/res/layout/add_session.axml:1: error: No resource identifier found for attribute 'remove_mode' in package 'com.app.monodroid' (App.MonoDroid)
我的項目名稱是App.MonoDroid。
如何在佈局文件中使用這些屬性?