このガイドに従ってListView
、アプリのカスタムを作成します。このチュートリアルでは、ottaseeという名前空間を使用します。これは、要素内のxml-namespaceとして定義する必要があります。だからここに私のコードのいくつかがあります:
<com.my.app.Layout.CustomListView
xmlns:ottasee="what_should_i_put_here?"
android:id="@+id/lastCases"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:divider="@null"
android:scrollbars="none"
ottasee:dropShadowBottom="true"
ottasee:dropshadowrightsrc="@drawable/drop_shadow"
/>
ottasee:dropShadowBottom
属性とがvaluesフォルダー内ottasee:dropshadowrightsrc
の自分の一部であることがわかります。attrs.xml
このような:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<declare-styleable name="DropShadowListView">
<attr format="boolean" name="dropShadowLeft"></attr>
<attr format="reference" name="dropShadowLeftSrc"></attr>
<attr format="boolean" name="dropShadowRight"></attr>
<attr format="reference" name="dropShadowRightSrc"></attr>
<attr format="boolean" name="dropShadowTop"></attr>
<attr format="reference" name="dropShadowTopSrc"></attr>
<attr format="boolean" name="dropShadowBottom"></attr>
<attr format="reference" name="dropShadowBottomSrc"></attr>
</declare-styleable>
</resources>
ListView
ファイルから属性を取得するには、のxml名前空間をどのように定義する必要がありattrs.xml
ますか?
ありがとう!
編集
私のCustomListViewはパッケージの下にあり、com.my.app.Layout
次のようにnsを宣言しようとしました。xmlns:ottasee="http://schemas.android.com/apk/res/com.my.app.Layout
しかし、xmlファイルでエラーが発生するだけです。
Multiple annotations found at this line:
- error: No resource identifier found for attribute 'dropShadowBottom' in package
'com.my.app.Layout'
- error: No resource identifier found for attribute 'dropshadowrightsrc' in package
'com.my.app.Layout'
どうすれば正しいnsの設定を達成できますか?