还在为系统黑色的list而烦恼么,不罗嗦 ,先上图
如果只是功能的问题,那么你就要写自己的listview了,黑色的永远不能拿出去丢人,不过这个也挺丢人的,哈哈,各位,不要嘲笑我这个小菜鸟啊
main.xml
list_item.xml
package com.information;import java.util.ArrayList;import java.util.HashMap;import java.util.List;import android.app.Activity;import android.graphics.drawable.Drawable;import android.os.Bundle;import android.view.View;import android.widget.AdapterView;import android.widget.ImageView;import android.widget.ListView;import android.widget.SimpleAdapter;import android.widget.TextView;import android.widget.Toast;import android.widget.AdapterView.OnItemClickListener;public class TestInformationListViewActivity extends Activity { /** Called when the activity is first created. */ private TextView userName; private ImageView userImage; private ListView listView; List> list; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); userName = (TextView)findViewById(R.id.UserName); userImage = (ImageView)findViewById(R.id.UserImage); userName.setText("hello..."); //改变用户的头像 Drawable drawable = getResources().getDrawable(R.drawable.ic_launcher); userImage.setBackgroundDrawable(drawable); listView = (ListView)findViewById(R.id.listview); list = new ArrayList >(); for(int i=0 ;i<5;i++){ if(i==0){ HashMap map = new HashMap (); map.put("first", "设置"); list.add(map); } else if(i==1){ HashMap map = new HashMap (); map.put("first", "账号管理"); list.add(map); } else if(i==2){ HashMap map = new HashMap (); map.put("first", "意见反馈"); list.add(map); } else if(i==3){ HashMap map = new HashMap (); map.put("first", "浏览模式"); list.add(map); } else { HashMap map = new HashMap (); map.put("first", "关于"); list.add(map); } } SimpleAdapter simpleAdapter = new SimpleAdapter(this, list, R.layout.list_item, new String[]{"first"}, new int[]{R.id.groupItem}); listView.setAdapter(simpleAdapter); listView.setOnItemClickListener(new ButtonListClickListener()); } class ButtonListClickListener implements OnItemClickListener{ @Override public void onItemClick(AdapterView parent, View view, int position, long id) { // TODO Auto-generated method stub Toast.makeText(TestInformationListViewActivity.this, (CharSequence) list.get(position).get("first"), 0).show(); } }}