2014.1.28
2014-01-28 13:45
183 查看
1.
2.
3.
4. 将popupwindow放在屏幕中间
vi=(RelativeLayout)this.findViewById(R.id.maintainlayout); //主布局
pop.showAtLocation(vi, Gravity.CENTER, 0, 0);
orderlist_lv=(ListView)this.findViewById(R.id.orderlist_lv); SimpleAdapter adapter=new SimpleAdapter(this, getData(), R.layout.orderlist_item, new String[]{"tv6","tv8"}, new int[]{R.id.textView6,R.id.textView8}); orderlist_lv.setAdapter(adapter); //获取数据 private List<Map<String, Object>> getData() { List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); Map<String,Object> map=new HashMap<String,Object>(); map.put("tv6", "张帅男"); map.put("tv8", "顾德国"); list.add(map); map=new HashMap<String,Object>(); map.put("tv6", "张德江"); map.put("tv8", "李富国"); list.add(map); map=new HashMap<String,Object>(); map.put("tv6", "王宝强"); map.put("tv8", "张三"); list.add(map); return list; }
2.
searchclient_list__lv.setOnItemClickListener(listener); //有名内部类实现 private OnItemClickListener listener=new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent intent=new Intent(SearchClient_listActivity.this,SearchClient_listActivity_detail.class); startActivity(intent); } };
3.
/* * 创建popupwindow弹出框 * parent 是为了在此组件之下 */ protected void createPopupWindow(View parent) { LayoutInflater inflater=LayoutInflater.from(this); View view=inflater.inflate(R.layout.orderlist_popup, null); // 创建PopupWindow对象 final PopupWindow pop = new PopupWindow(view, LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, true); pop.setBackgroundDrawable(new BitmapDrawable()); // 需要设置一下此参数,点击外边可消失 pop.setOutsideTouchable(true); //设置点击窗口外边窗口消失 pop.setFocusable(true); // 设置此参数获得焦点,否则无法点击 // pop.setAnimationStyle(R.style.PopupAnimation); if(pop.isShowing()){ //如果pop是有的 pop.dismiss(); }else{ //弹出框在组件之下 pop.showAsDropDown(this.findViewById(R.id.orderlist_1)); } }
4. 将popupwindow放在屏幕中间
vi=(RelativeLayout)this.findViewById(R.id.maintainlayout); //主布局
pop.showAtLocation(vi, Gravity.CENTER, 0, 0);
相关文章推荐
- TCP的三次握手(建立连接)和四次挥手(关闭连接)
- FreeBsd9.2 安装Apache2.2实现代理
- linux下chrome字体发虚
- APP建摸——一套描述app的方法论
- windows 下nginx和tomcat集成
- 爱~情~
- 关于android webview中访问web页面带有upload上传控件的解决办法
- Oracle用户、权限、角色管理
- KEYCODE列表
- JVM的类的加载
- ios UIWebView截获html并修改便签内容(转载)
- .net链接oracle 10G数据库发生异常
- div自增长后背景色或图片随之增长
- 前端页面设置只读属性组件
- 我的.zshrc
- mysqldump命令之数据库迁移
- The 3n + 1 problem
- 浅谈NoSQL
- Cookie、 Session和 Cache
- uint8_t / uint16_t / uint32_t /uint64_t 是什么数据类型 - 大总结,看完全明白了