怎样才能让Android中的item进行页面转换

private void initResideListener() {
  // TODO Auto-generated method stub
  // 点击个人中心
  menu_header.setOnClickListener(new OnClickListener() {

   @Override
   public void onClick(View v) {
    // TODO Auto-generated method stub
    Toast.makeText(MainActivity.this, "进入个人中心界面", Toast.LENGTH_LONG).show();
   }
  });
  // 点击子菜单选项
  menuListView.setOnItemClickListener(new OnItemClickListener() {

   @Override
   public void onItemClick(AdapterView<?> parent, View view,
     int position, long id) {
    // TODO Auto-generated method stub
    switch (position) {
    case 0:
     Toast.makeText(MainActivity.this, "0", Toast.LENGTH_LONG).show();
     break;
    case 1:
     Toast.makeText(MainActivity.this, "1", Toast.LENGTH_LONG).show();
     break;
    case 2:
     Toast.makeText(MainActivity.this, "2", Toast.LENGTH_LONG).show();
     break;
    case 3:
     Toast.makeText(MainActivity.this, "3", Toast.LENGTH_LONG).show();
     break;
    case 4:
     Toast.makeText(MainActivity.this, "4", Toast.LENGTH_LONG).show();
     break;
    case 5:
     Toast.makeText(MainActivity.this, "5", Toast.LENGTH_LONG).show();
     break;
    default:
     break;
    }
   }
  });
  //进入设置界面
  menu_setting.setOnClickListener(new OnClickListener() {
   
   @Override
   public void onClick(View v) {
    // TODO Auto-generated method stub
    Toast.makeText(MainActivity.this, "进入设置界面", Toast.LENGTH_LONG).show();
   }
  });

 }

 private List<Map<String, Object>> getMenuData() {
  // TODO Auto-generated method stub
  List<Map<String, Object>> data = new ArrayList<Map<String, Object>>();  
  Map<String, Object> item;

  item = new HashMap<String, Object>();
  item.put("item", "个人设置");
  item.put("image", R.drawable.ic_launcher);
  data.add(item);

  item = new HashMap<String, Object>();
  item.put("item", "我的帖子");
  item.put("image", R.drawable.ic_launcher);
  data.add(item);

  item = new HashMap<String, Object>();
  item.put("item", "个人装扮");
  item.put("image", R.drawable.ic_launcher);
  data.add(item);

  item = new HashMap<String, Object>();
  item.put("item", "我的收藏");
  item.put("image", R.drawable.ic_launcher);
  data.add(item);


  return data;
 }

希望大神解答

qq_一只特立独行的猪_9
浏览 1467回答 0
0回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java
Android