/** @Method: albumPopupwin @Description: menuPopupwindow�����ü���Ӧ */ private void albumPopupwin() { ListView popList; ImageView popImage; SimpleAdapter adapter; List<Map<String, Object>> foldersList = new ArrayList<Map<String, Object>>(); LayoutInflater mLayoutInflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); ViewGroup menuView = (ViewGroup) mLayoutInflater.inflate(R.layout.listview_pop, null, true); popList = (ListView) menuView.findViewById(R.id.poplistview); popImage = (ImageView) menuView.findViewById(R.id.poplistviewimage); // popwindow �ı��� popImage.setImageDrawable(getResources().getDrawable(R.drawable.pop_titleimg)); // ��������ʽ adapter = new SimpleAdapter( this, foldersList, R.layout.smallinsidelistview, new String[] {"albumName", "picnum", "img"}, new int[] {R.id.smalluserName, R.id.smallipInfo, R.id.smalluserImg}); popList.setAdapter(adapter); foldersList.clear(); for (int i = 1; i < albumArray.length; i += 2) { HashMap<String, Object> map = new HashMap<String, Object>(); map.put("albumName", albumArray[i]); map.put("picnum", albumArray[i + 1] + "��"); map.put("img", R.drawable.folder); foldersList.add(map); adapter.notifyDataSetChanged(); } popList.requestFocus(); popList.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { Log.d("debug", albumArray.length + ""); choosedAlbum = albumArray[arg2 * 2 + 1]; uploadThread = new Thread(uploadRunnable); // ����һ�����߳� uploadThread.start(); albumPopupWindow.dismiss(); // ���ѡ��� showProgress(); // ����� } }); popList.setOnKeyListener( new OnKeyListener() { // ���㵽��gridview�ϣ�������Ҫ����˴��ļ����¼����������ֲ���Ӧ�����¼������ @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_MENU: if (albumPopupWindow != null && albumPopupWindow.isShowing()) { albumPopupWindow.dismiss(); } break; } System.out.println("menuGridfdsfdsfdfd"); return true; } }); int poplength = (albumArray.length - 1) * 53 + 65; Log.d("10", albumArray.length + ""); if (poplength > 595) poplength = 595; albumPopupWindow = new PopupWindow(menuView, 300, poplength, true); albumPopupWindow.setBackgroundDrawable(new BitmapDrawable()); albumPopupWindow.setAnimationStyle(R.style.PopupAnimation); albumPopupWindow.showAtLocation(findViewById(R.id.filpperparent), Gravity.CENTER, 0, 0); albumPopupWindow.update(); }