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

熱點內容
keil5編程32單片機 瀏覽:635
pdf文件截取 瀏覽:159
伺服器放到雲上和雲下有啥區別 瀏覽:672
單片機玻璃管加熱研究成果 瀏覽:762
財產pdf 瀏覽:797
java添加圖標 瀏覽:892
命令與征服4任務攻略 瀏覽:97
演算法和邏輯程序驗證 瀏覽:773
用戶管理系統php模板 瀏覽:425
中國銀行app賬號怎麼登錄 瀏覽:873
安卓手機icloud雲伺服器地址 瀏覽:807
加密門禁如何寫到小米手機 瀏覽:177
java靜態方法的多線程 瀏覽:273
CAXAXp下載打不開要加密 瀏覽:252
開鎖pdf 瀏覽:96
python可視化奶茶 瀏覽:232
命令方字幕 瀏覽:594
蘋果手機如何連接ipad伺服器 瀏覽:988
列印矩陣java 瀏覽:407
如何雙開一個不能雙開的app 瀏覽:542