导航:首页 > 操作系统 > androidlistview美化

androidlistview美化

发布时间:2024-01-13 21:59:35

1. android listView 怎么指定项的背景设置

android listview指定项设定背景步骤如下:

  1. 监听列表项监听事件,取得被点击的view,设置为:view.setSelector("true");

2.在适配器塌镇中,用if-else语句,判断选择的列表项设置背景,没有选中的则默认背景,代码如下:


java">try{
if(selectItem==position){
messagetitle.setTextColor(android.graphics.Color.BLACK);
messagetime.setTextColor(android.graphics.Color.BLACK);
viewHolder.messagetitle.setText(maps.get(position)
.get("messagetitle").toString());
viewHolder.messagetime.setText(maps.get(position)
.get("messagetime").toString());
convertView.findViewById(R.id.expandable1)
.setBackgroundColor(android.graphics.Color.WHITE);
convertView.findViewById(R.id.expandable1)
.setBackgroundResource(R.drawable.menu_shapeclick);
}else{
messagetitle.setTextColor(android.graphics.Color.WHITE);
messagetime.setTextColor(android.graphics.Color.WHITE);
viewHolder.messagetitle.setText(maps.get(position)
.get("messagetitle").toString());
viewHolder.messagetime.setText(maps.get(position)
孙闹.get("messagetime").toString());
convertView.findViewById(R.id.expandable1)
.setBackgroundResource(
团凯粗R.drawable.menu_shapeunonclick);
}
}catch(Exceptionex){
ex.printStackTrace();
}
returnconvertView;
阅读全文

与androidlistview美化相关的资料

热点内容
程序员蜗居北六环 浏览:263
c高质量编程pdf 浏览:285
手机app免费服务器地址 浏览:487
java去除回车换行 浏览:480
华为s9303交换机限速命令 浏览:804
单片机储存如何区分重叠部分 浏览:768
如何进入有mod的服务器 浏览:980
在哪里下载萤火app 浏览:819
androidtimer线程 浏览:36
服务器如何加入网址 浏览:458
git本地服务器地址 浏览:614
马桶mt什么app好 浏览:664
头像高清程序员 浏览:917
java24点游戏 浏览:644
rdx比赛为什么换服务器 浏览:513
如何看服务器的磁盘 浏览:169
python如何让画笔加速 浏览:672
在哪里可以下载加密微信 浏览:399
单片机pc通信 浏览:127
单片机判断字符串 浏览:896