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

热点内容
php接口有什么用 浏览:382
iis如何安装php 浏览:791
k5嗜血魔键安卓怎么调好用 浏览:834
建行app中如何添加银行卡 浏览:281
简便算法100点 浏览:161
如何创新我的世界服务器 浏览:881
战地怎么看服务器地址 浏览:348
vue怎么打包放上服务器 浏览:165
为什么安卓服夏日活动没有兔子头 浏览:894
pubg为什么显示服务器连接失败 浏览:650
阿里云扫码登录服务器 浏览:971
化学基础pdf 浏览:896
51单片机晶码管 浏览:281
怎么查服务器假死原因日志在哪看 浏览:277
扫描pdf文件 浏览:926
解压密码百度云在线解压 浏览:767
传播学算法推荐 浏览:749
我的世界网络游戏如何查找服务器 浏览:258
安卓和苹果通讯录怎么互传 浏览:203
怎么打开隐私与应用加密的菜单 浏览:416