自定义AlertDialog,以及解决自定义Dialog中EditText不能弹出输入法的问题
2013-12-17 17:06
531 查看
private void showAlertDialog(final int position,String name,int count) {LayoutInflater inflater = LayoutInflater.from(context);View view = inflater.inflate(R.layout.shoppingcart_editcount, null);final AlertDialog dialog = new AlertDialog.Builder(context).create();//先设置一边setview(),可以解决edittext不能弹出输入法的问题dialog.setView(view);dialog.show();Window window = dialog.getWindow();window.setContentView(R.layout.shoppingcart_editcount);TextView textview = (TextView) window.findViewById(R.id.shoppingcart_editcount_productname_textview);final EditText editText = (EditText) window.findViewById(R.id.shoppingcart_editcount_count_edittext);Button positiveButton = (Button) window.findViewById(R.id.positiveButton);Button negativeButton = (Button) window.findViewById(R.id.negativeButton);textview.setText(name);editText.setHint(String.valueOf(count));positiveButton.setOnClickListener(new OnClickListener() {@Overridepublic void onClick(View v) {}});negativeButton.setOnClickListener(new OnClickListener() {@Overridepublic void onClick(View v) {}});}
相关文章推荐
- android 代码实现控件之间的间距
- 解決Linux下Android开发真机调试设备不被识别问题
- [Android]在代码里运行另一个程序的方法
- [软件咨询]WPS2012正式版已发布 金山Office移动版4.0发布
- Android笔记-Linux Kernel Ftrace (Function Trace)解析
- android USB如何修改VID具体实现
- Android Mouse实现过程详细笔记
- 深入Android Browser配置管理的详解
- Android Mms之:深入理解对话列表管理
- Android APP与媒体存储服务的交互
- android 多线程技术应用
- Android之采用execSQL与rawQuery方法完成数据的添删改查操作详解
- Android数据类型之间相互转换系统介绍
- 通过Android trace文件分析死锁ANR实例过程
- Android实现左右滑动效果的方法详解
- Android 各国语言缩写及简称详细介绍
- Android 自动判断是电话,网址,EMAIL方法之Linkify的使用
- android IPC之binder通信机制
- Android应用开发中模拟按下HOME键的效果(实现代码)
- Android 读写文件方法汇总