android-自定义列表视图的选择器“更改ListView背景-奇怪的行为”

android-自定义列表视图的选择器“更改ListView背景-奇怪的行为”,第1张

概述我正在使用此tutorials,并且要为此列表视图添加选择器.我尝试了一些代码,但没有用.我该怎么做.我将代码用作list_selector.xml<?xmlversion="1.0"encoding="utf-8"?><selectorxmlns:android="http://schemas.android.com/apkes/android"><itemandroid:state

我正在使用此tutorials,并且要为此列表视图添加选择器.我尝试了一些代码,但没有用.我该怎么做.

我将代码用作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>

和我的列表视图

<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>

解决方法:

检查以下链接.在这里,我提到了完整的代码以正确使用ListvIEw.使用此方法,我们可以实现任何ListvIEw行为.我们也可以嵌入动画.

Change ListView background – strange behaviour

希望这个帮助:)

总结

以上是内存溢出为你收集整理的android-自定义列表视图的选择器“更改ListView背景-奇怪的行为”全部内容,希望文章能够帮你解决android-自定义列表视图的选择器“更改ListView背景-奇怪的行为”所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/web/1095430.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-28
下一篇2022-05-28

发表评论

登录后才能评论

评论列表(0条)

    保存