我用这教程和我要添加选择此列表视图。我想C $ CS一些$,但所行的工作。我怎样才能做到这一点。
我用code为list_selector.xml
< XML版本=1.0编码=UTF-8&GT?;
<选择的xmlns:机器人=http://schemas.android.com/apk/res/android>
<项目安卓state_focused =真
机器人:可绘制=@可绘制/ list_selector_background_focus/>
<项目的android:STATE_ pressed =真
机器人:可绘制=@可绘制/ list_selector_background_ pressed/>
< /选择器>
和我的列表视图
<的ListView
机器人:ID =@ + ID / select_names_tags_lv
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:listSelector =@可绘制/ list_selector
机器人:layout_alignParentTop =假
机器人:layout_gravity =center_vertical>
< / ListView控件>
解决方案
请检查下面的链接。在这里,我提一个完整的code正确使用列表视图。使用这个我们可以实现任何ListView控件的行为。我们可以嵌入动画也。
Change ListView的背景 - 奇怪的行为
希望这有助于:)
I am using this tutorials and I want to add selectors for this list view. I tried some codes but it doest work. How can I do it.
I used code as list_selector.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true"
android:drawable="@drawable/list_selector_background_focus" />
<item android:state_pressed="true"
android:drawable="@drawable/list_selector_background_pressed" />
</selector>
and my List view
<ListView
android:id="@+id/select_names_tags_lv"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:listSelector="@drawable/list_selector"
android:layout_alignParentTop="false"
android:layout_gravity="center_vertical">
</ListView>
解决方案
Check the following link. here i mentioned a complete code to use listview properly. Using this we can achieve any listview behavior. We can embed animation also.
Change ListView background - strange behaviour
Hope this help :)
上一篇:Android的到GAE的Restlet例子在Android端不起作用不起作用、例子、Android、GAE
下一篇:PhoneGap的/科尔多瓦在Mac上添加的Android平台不被识别为核心的科尔多瓦平台科尔、多瓦、平台、不被