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

热点内容
命令方块生存放不了吗 浏览:697
程序员入门很难吗 浏览:101
70后程序员照片 浏览:191
一个普通程序员能干多久 浏览:934
adobe的PDF转换器 浏览:859
单片机数字码表汇编 浏览:483
单片机开发用的软件 浏览:158
程序员8个算法题 浏览:402
php题库系统 浏览:227
王牌战争文明重启选什么服务器 浏览:659
简述对称加密法 浏览:664
c语言数学编程 浏览:997
F1B命令 浏览:630
cs命令快捷键 浏览:852
阿里云购买服务器如何用现金支付 浏览:697
pythontime等待 浏览:995
单片机串行通信方式 浏览:505
android表格demo 浏览:284
安卓怎么让相册不显示网页 浏览:321
php文件系统源码 浏览:733