listview當選中某一個item時設置背景色其餘的不變:android 能夠使用listview.setOnFoucsChangeListener(listener) ;ide /**spa * listview得到焦點和失去焦點時背景顏色的變化圖片 * @author longci * */ private class MyOnFocusChangeListener implements OnFocusChangeListener{ @Override public void onFocusChange(View v, boolean hasFocus) {it //判斷是否有焦點,若是有焦點則設置背景色爲想要的顏色或者背景圖片,當失去焦點的時候再設置爲原來的顏色table if(hasFocus == true){ //得到焦點 videoView.setSelector(android.R.color.white) ; } else{ //失去焦點 videoView.setSelector(R.color.unselected) ; } } }class |