導航:首頁 > 操作系統 > 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美化相關的資料

熱點內容
主機虛擬雲伺服器 瀏覽:617
刪除分區加密的空間會不會恢復 瀏覽:702
京東app客戶上門怎麼看搜索量 瀏覽:739
怎麼在農行app購買黃金 瀏覽:45
c型開發板和單片機 瀏覽:146
虛擬機建立用戶的模板文件夾 瀏覽:904
無錫代碼編程培訓班 瀏覽:631
eps圖形數據加密 瀏覽:933
沒有滴滴app怎麼打車 瀏覽:101
大數乘法java 瀏覽:1001
如何登錄伺服器看源碼 瀏覽:526
如何做伺服器端 瀏覽:157
注冊伺服器地址指什麼 瀏覽:434
文本命令行 瀏覽:98
撲克牌睡眠解壓 瀏覽:196
rc4演算法流程圖 瀏覽:161
胡蘿卜解壓方法 瀏覽:38
掃描pdf格式軟體 瀏覽:880
程序員在銀行開賬戶 瀏覽:517
android資料庫下載 瀏覽:752