导航:首页 > 操作系统 > 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美化相关的资料

热点内容
pythontime等待 浏览:982
单片机串行通信方式 浏览:492
android表格demo 浏览:270
安卓怎么让相册不显示网页 浏览:307
php文件系统源码 浏览:720
易信java 浏览:493
北仑二级压缩螺杆机 浏览:57
加密路线免费入口 浏览:753
计算器程序员是干嘛的 浏览:363
数控编程里fo是啥键 浏览:667
javacdataxml 浏览:956
本机tcp服务器地址 浏览:439
切换pdf 浏览:104
iturns下载的app在哪里 浏览:653
云起书院App在哪里 浏览:627
怎么对hex文件进行加密 浏览:298
pdf少年时 浏览:967
两个同名文件夹同步 浏览:643
拍照文件夹哪个好用 浏览:103
文件夹和书包 浏览:523