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

热点内容
android数据库下载 浏览:744
中午服务器崩溃怎么办 浏览:423
产品经理和程序员待遇 浏览:439
解忧程序员免费阅读 浏览:107
录像免压缩 浏览:504
总结所学过的简便算法 浏览:360
南昌哪些地方需要程序员 浏览:759
三台服务器配置IP地址 浏览:173
如何用命令方块连续对话 浏览:278
win7linux共享文件夹 浏览:304
命令符打开本地服务 浏览:599
android应用程序源码 浏览:703
安卓开发工程师简历怎么写 浏览:61
热水器水量服务器是什么意思 浏览:117
stk卫星编译 浏览:480
对后台程序员的要求 浏览:761
ios大文件夹图标 浏览:626
生的计划pdf 浏览:715
oppoa93加密便签在哪查找 浏览:21
两个数字的加减乘除运算编程 浏览:227