- 浏览: 45422 次
- 性别:
- 来自: 上海
文章分类
最新评论
AlertDialog包含EditText,软键盘不能弹出的解决方法
define_dialog_2.xml
[size=large]
[size=large]public static void editContentDialog(final Context context) { final AlertDialog dialog = new AlertDialog.Builder(context).create(); LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); RelativeLayout layout = (RelativeLayout)inflater.inflate(R.layout.define_dialog_2, null); dialog.setView(layout); dialog.show(); Window window = dialog.getWindow(); // *** 主要就是在这里实现这种效果的. window.setContentView(R.layout.define_dialog_2); RelativeLayout rlCancel = (RelativeLayout) window.findViewById(R.id.rl_left); RelativeLayout rlBoundPhone = (RelativeLayout) window .findViewById(R.id.rl_right); TextView tvTitle = (TextView) window.findViewById(R.id.tv_dialog_title); final EditText etContent = (EditText) window .findViewById(R.id.et_content); TextView tvLeft = (TextView) window.findViewById(R.id.tv_left); TextView tvRight = (TextView) window.findViewById(R.id.tv_right); tvTitle.setText("新建列表"); tvTitle.setVisibility(View.VISIBLE); etContent.setTextSize(16.0f); tvLeft.setText("取消"); tvRight.setText("保存"); rlCancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); rlBoundPhone.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.setCanceledOnTouchOutside(true);// 设置点击屏幕Dialog不消失 }[/size]
define_dialog_2.xml
[size=large]
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="30dp" android:layout_marginRight="30dp" android:background="@drawable/corner_box_white_2" > <TextView android:id="@+id/tv_dialog_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:gravity="center" android:textColor="@color/black" android:text="手机绑定" android:visibility="visible" android:textSize="20sp" /> <!-- <TextView android:id="@+id/tv_dialog_content" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:layout_marginTop="10dp" android:layout_marginBottom="10dp" android:gravity="center" android:textColor="@color/black" android:layout_below="@id/tv_dialog_title" android:minHeight="40dp" android:text="法杰拉尔家乐福吉安网络服务了解放军阿拉维" android:textSize="20sp" /> --> <EditText android:id="@+id/et_content" android:layout_width="match_parent" android:layout_height="35dp" android:layout_below="@id/tv_dialog_title" android:layout_marginTop="15dp" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:singleLine="true" android:ellipsize="end" android:textColor="@color/black" android:focusable="true" android:focusableInTouchMode="true" android:hint="请输入新列表名称" android:gravity="center" android:text="猎人" android:background="@drawable/corner_box_white_90" /> <View android:id="@+id/view_line" android:layout_width="match_parent" android:layout_height="1dp" android:layout_below="@id/et_content" android:layout_marginTop="15dp" android:background="@color/gray" /> <View android:id="@+id/view_shuxian" android:layout_width="1dp" android:layout_height="45dp" android:layout_below="@id/view_line" android:layout_centerHorizontal="true" /> <RelativeLayout android:id="@+id/rl_left" android:layout_width="match_parent" android:layout_height="45dp" android:layout_below="@id/view_line" android:layout_toLeftOf="@id/view_shuxian" android:background="@drawable/unicorn_left_bottom" > <TextView android:id="@+id/tv_left" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerInParent="true" android:gravity="center" android:textColor="@color/white" android:textSize="20sp" /> </RelativeLayout> <RelativeLayout android:id="@+id/rl_right" android:layout_width="match_parent" android:layout_height="45dp" android:layout_below="@id/view_line" android:layout_toRightOf="@id/view_shuxian" android:background="@drawable/unicorn_right_bottom" > <TextView android:id="@+id/tv_right" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerInParent="true" android:gravity="center" android:textColor="@color/white" android:textSize="20sp" /> </RelativeLayout> </RelativeLayout> </RelativeLayout>[/size]
发表评论
-
android 判断ImageView当前显示的是哪一张图片
2015-12-29 14:40 1588判断ImageView当前显示的是哪一张图片 private ... -
Android 4.4及以上WebView问题
2015-10-27 17:41 10461. 4.4系统以上WebView页面内容重叠问题 连接 ... -
无法上传so文件到svn上
2015-05-25 16:48 859Window-->Team-->Ignored R ... -
Android 文件下载与解压缩
2015-03-20 18:20 342转载:http://blog.csdn.net/hopehe8 ... -
Cocos2dx与Android进行交叉编译的大概步骤
2015-02-06 17:22 1113cocos2d交叉编译配置: 1.下载cygwin 64位ex ... -
博客链接
2014-11-26 16:01 01.好文章博客:http://blog.csdn.net/xi ... -
android一些基础功能汇总
2014-11-03 10:49 7171.Android开发 给图片加边框 http://www. ... -
创建文件夹和文件
2014-10-22 15:15 664String commonPath = Environment ... -
Android 线程的使用(传递多个参数)
2014-08-06 11:08 20931.Thread new Thread(new Runnabl ... -
cocos2dx 内存管理
2014-08-04 18:18 561cocos2dx 内存管理 转载自:http://blog. ... -
android读取图片
2014-07-25 11:56 984[size=large]一:读取res中的图片 //读取本地r ... -
Android ListView里设置默认Item的背景颜色
2014-07-23 11:51 808<?xml version="1.0" ... -
以某一点旋转(RotateAnimation)
2014-06-20 12:07 1742//自适应屏幕大小 webview.getSetting ... -
popWindow
2014-05-23 18:07 373popWindow -
自定义跑马灯
2014-05-23 16:46 536自定义跑马灯 -
WebView的使用总结
2014-05-05 12:09 640//自适应屏幕大小 webview.getSettings ... -
android 动态设置布局
2014-03-26 11:03 9271.动态设置RelativeLayout的布局 // 根据 ... -
android移动开发的很好的功能的网页
2014-03-19 18:15 625android经典DEMO http://blog.csdn ... -
android Uri获取真实路径转换成File的方法
2014-02-14 16:23 1983有的时候要将android uri如content://me ... -
android学习的进阶(从零开始,从初级到高级)
2014-02-08 12:08 2146轻松几步学Android开发 1. ...
相关推荐
android 自定义AlertDialog弹出键盘可以输入的
获取到layout的view之后,直接调用AlertDialog.Builder的setView方法即可。 2、如何对自定义AlertDialog中的控件进行操作? 解答: 于fragment中的操作类似,首先要获取该layout的view,然后通过该view获取到其中...
Android之简单的登录界面的实现、使用 AlertDialog和全局广播实现被强制下线功能、自定义一个带有清除按钮的EditText
主要介绍了Android中自定义的dialog中的EditText无法弹出输入法解决方案,需要的朋友可以参考下
android AlertDialog对话框的类型集合 ,比较全面的讲述了 AlertDialog 的 种类 , Demo 的综合性比较强 , Demo 可直接运行
Android alertDialog对话框.zip源码资源下载Android alertDialog对话框.zip源码资源下载
android AlertDialog使用例程 一个在安卓平台上开发使用AlertDialog的例子 很实用很全哦
* 各种功能实现弹窗(自定义弹窗位置,添加动画效果) * 1.设置AlertDialog弹窗并且2秒后自动关闭(自定义关闭AlertDialog) * 2.设置popuwindow弹窗并且2秒后自动关闭 * 3.弹出后自带震动提示
Android AlertDialog对话框 自定义实现遮罩层
android AlertDialog 单选 多选 输入框 疯狂android讲义
接到一个需求,点击某个按钮需要弹出一个带有EditText的AlertDialog弹窗,实现起来并不难,简单记录下方便以后使用。
Android之AlertDialog源码
android自定义AlertDialog,例如支付页面,先弹出自定义AlertDialog询问是否愿意支付,确定则弹出另外一个自定义AlertDialog,选择支付方式,android自定义AlertDialog,android自定义AlertDialog,android自定义...
【Android】对话框 AlertDialog
AlertDialog,分别弹出对话框、单选框、对选对话框,并标有注释适合初学者,AlertDialog.Builder builder=new Builder(this);
Android之修改AlertDialog对话框及使用系统Holo风格
Android alertDialog对话框.rar
Android alertDialog对话框.zip
Android 自定义实现一个AlertDialog对话框,提示框或警告框弹出式对话框,套用了系统Holo风格,生成符合系统主题的AlertDialog.Builder,可以分别定义弹出提示的标题文字及提示内容: builder.setTitle("Test ...