我是初学者,并尝试按照教程学习并通过它学习。但是我收到了上述错误:找不到属性的资源标识符" click_remove_id"在包装' com.jams.music.player'。它在布局文件夹中。请帮我解决这个问题。这是给出错误的代码..
<!-- Current queue drawer --> <RelativeLayout android:id="@+id/main_activity_queue_drawer" android:layout_width="320dp" android:layout_height="match_parent" android:layout_gravity="end" > <TextView android:id="@+id/empty_queue_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="@string/queue_is_empty" android:layout_marginLeft="25dp" android:layout_marginRight="25dp" android:visibility="invisible" android:textAppearance="?android:attr/textAppearanceMedium" /> <RelativeLayout android:layout_height="wrap_content" android:layout_width="match_parent" android:layout_below="@+id/divider" > <com.mobeta.android.dslv.DragSortListView xmlns:dslv="http://schemas.android.com/apk/res/com.jams.music.player" android:id="@+id/queue_list_view" android:layout_width="fill_parent" android:layout_height="wrap_content" android:drawSelectorOnTop="true" dslv:click_remove_id="@+id/remove_song_from_queue" dslv:drag_enabled="true" dslv:drag_handle_id="@+id/playlists_flipped_handle" dslv:drag_scroll_start="0.33" dslv:drag_start_mode="onDown" dslv:float_alpha="0.6" dslv:max_drag_scroll_speed="0.8" dslv:remove_enabled="true" dslv:remove_mode="clickRemove" dslv:slide_shuffle_speed="0.5" /> </RelativeLayout>
答案 0 :(得分:0)
<com.mobeta.android.dslv.DragSortListView
xmlns:dslv="http://schemas.android.com/apk/res/com.jams.music.player"
android:id="@+id/queue_list_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawSelectorOnTop="true"
dslv:click_remove_id="@+id/remove_song_from_queue"
dslv:drag_enabled="true"
dslv:drag_handle_id="@+id/playlists_flipped_handle"
dslv:drag_scroll_start="0.33"
dslv:drag_start_mode="onDown"
dslv:float_alpha="0.6"
dslv:max_drag_scroll_speed="0.8"
dslv:remove_enabled="true"
dslv:remove_mode="clickRemove"
dslv:slide_shuffle_speed="0.5" />
从提到的小部件中删除此名称空间,并将其添加到父级布局。xmlns:dslv="http://schemas.android.com/apk/res/com.jams.music.player
下面提到的事情,您应该在attrs.xml
中作为资源
click_remove_id
drag_enabled
drag_handle_id
drag_scroll_start
drag_start_mode
float_alpha
max_drag_scroll_speed
remove_enabled
remove_mode
slide_shuffle_speed
答案 1 :(得分:0)
Boopathi的回答是对的。
只需要这些属性的数据类型。在attrs.xml文件中添加下面提到的代码
<attr name="click_remove_id" format="string" />
<attr name="drag_enabled" format="boolean" />
<attr name="drag_handle_id" format="integer" />
<attr name="drag_scroll_start" format="float" />
<attr name="drag_start_mode" format="string" />
<attr name="float_alpha" format="float" />
<attr name="max_drag_scroll_speed" format="float" />
<attr name="remove_enabled" format="boolean" />
<attr name="remove_mode" format="string" />
<attr name="slide_shuffle_speed" format="float" />