
我想更改在ExpandableListVIEw中单击的子项的背景颜色.
也就是说,当点击任何孩子时,它的背景颜色应该被改变.
我试图以这种方式去它,但它选择了一些其他行,而不是已被点击的那一行.
public boolean onChildClick(ExpandableListVIEw parent, VIEw v, int groupposition, int childposition, long ID) { parent.getChildAt(childposition).setBackgroundcolor(color.DKGRAY); return false;}请告诉我可能缺少的东西.
解决方法:
怎么说让你试着直接引用你的视图并设置这样的背景,
public boolean onChildClick(ExpandableListVIEw parent, VIEw v, int groupposition, int childposition, long ID) { v.setBackgroundcolor(color.BLUE); return false;} 总结 以上是内存溢出为你收集整理的在可扩展ListView Android中更改单击子项的背景颜色全部内容,希望文章能够帮你解决在可扩展ListView Android中更改单击子项的背景颜色所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)