EditTex 弹出软件胖的问题 EditTex 默认是会弹出软键盘的,我自己写了一个dailog,继承的是alertdialog,界面里有个edittext,点击它,不弹出然键盘了,这样我就输入不聊中文了,怎样才能弹出软键盘呢?qq中病毒,上不了,郁闷呢。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可能是你的EditText没有获取到焦点。你仔细检查下,在edittext可以添加requestFoucus()之类的属性,让它获取焦点。 <?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="There's beautiful girl above." android:digits=".123)" /></LinearLayout>通过运行 ,没问题,焦点(即光标)在上面动动,就会弹出来,反应没那么快我这是三个选项JAPANEASE IME .ANDROID KEYBOARD,还有个搜狗输入法。我用ANDROID 键盘。权用英文表达。你贴我的去试试,要是不行。 你退到主页面,点击settings-->LANGUAGE AND KEYBOARD -->ANDROID KEYBOARD.或者是搜狗。然后返回。或者退出。重新运行。 <?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id = "@+id/layout_root" android:orientation = "vertical" android:layout_width="220dip" android:layout_height="280dip" > <TextView android:text="请输入账号" android:id="@+id/account_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize = "18dip"></TextView> <Spinner android:id="@+id/account_value" android:layout_width="220dip" android:layout_height="wrap_content" android:layout_marginTop = "10dip"></Spinner> <TextView android:text="请输入密码" android:id="@+id/paw_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize = "18dip"></TextView> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="EditText" android:id="@+id/paw_value" android:focusable = "true" android:layout_marginTop = "10dip" ></EditText> <LinearLayout android:layout_width="wrap_content" android:id="@+id/linearLayout1" android:layout_height="wrap_content" android:orientation = "horizontal" android:layout_marginBottom = "10dip" android:layout_marginTop = "70dip"> <ImageButton android:layout_width="wrap_content" android:src="@drawable/icon" android:id="@+id/login_ok" android:layout_height="50dip" ></ImageButton> <ImageButton android:layout_width="wrap_content" android:src="@drawable/icon" android:id="@+id/login_back" android:layout_height="50dip" android:layout_marginLeft = "70dip" android:layout_marginRight = "10dip"></ImageButton> </LinearLayout></LinearLayout> dialog是自己写的,继承自alertdialog,在oncreate函数里,setcontextview(),将xml文件加载进去,代码如下@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); //getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); setContentView(R.layout.login_dialog); 原来我继承的是alertdialog,改成继承dailog就没这个问题了。 谢谢你的回答,我的问题和你的有点不一样。麻烦帮我一下。setContentView(R.layout.*)中的layout xml我加了背景。如果我用alertdialog的setContentView方法样式是对的,但是edittext软键盘不可以用。如果我用dailog的setContentViewe方法edittext可以弹出键盘,但是样式不对,即使我设置成没有标题的模式,外面还是有一个黑色边框,去不掉。样式和期望的不一样。 可以设置dialog的样式的,把背景设置成透明的,你设置样式应该是通过value下的style设置的吧。 设置dialog的样式?不太明白我的样式是在xml中写好的。我只是使用setContentView(mView)放进去的。但是最外面有一个黑色的框子把我的dialog给包起来了,我现在就像去掉那个黑色的外框。 requestWindowFeature这个方法设置了没有标题。我的背景是黑色图片的,在xml中写的。最外面多白色边框,打错了不是黑色边框。原本就只是我的xml显示就可以了,但是怎么去掉白色边框呢? 我已经自己找到解决办法了,谢谢你对我的帮忙。thanks 自己的程序在2.3可以正常跑,在4.0自动退出 Android4.0上PopupWindow.update()的不解现象 关于从应用的源代码中提取出使用的native library的名字 android删除操作 android如何访问百度网站 Parcelable的问题 安卓关于变量中的16进制字符串转换成10进制字符串的问题 DEVICE_ATTR创建设备节点参数后无法调用到store函数 关于popupwindow 点击自动消失的问题 adb remount失败! listview布局问题 activty转换
你仔细检查下,在edittext可以添加requestFoucus()之类的属性,让它获取焦点。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="There's beautiful girl above."
android:digits=".123)"
/>
</LinearLayout>通过运行 ,没问题,焦点(即光标)在上面动动,就会弹出来,反应没那么快
我这是三个选项JAPANEASE IME .ANDROID KEYBOARD,还有个搜狗输入法。我用ANDROID 键盘。权用英文表达。你贴我的去试试,要是不行。 你退到主页面,点击settings-->LANGUAGE AND KEYBOARD -->ANDROID KEYBOARD.或者是搜狗。然后返回。或者退出。重新运行。
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id = "@+id/layout_root"
android:orientation = "vertical"
android:layout_width="220dip"
android:layout_height="280dip"
>
<TextView android:text="请输入账号" android:id="@+id/account_view" android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textSize = "18dip"></TextView>
<Spinner android:id="@+id/account_value" android:layout_width="220dip" android:layout_height="wrap_content"
android:layout_marginTop = "10dip"></Spinner>
<TextView android:text="请输入密码" android:id="@+id/paw_view" android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textSize = "18dip"></TextView>
<EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="EditText" android:id="@+id/paw_value"
android:focusable = "true" android:layout_marginTop = "10dip"
></EditText>
<LinearLayout android:layout_width="wrap_content" android:id="@+id/linearLayout1" android:layout_height="wrap_content" android:orientation = "horizontal"
android:layout_marginBottom = "10dip" android:layout_marginTop = "70dip">
<ImageButton android:layout_width="wrap_content" android:src="@drawable/icon" android:id="@+id/login_ok" android:layout_height="50dip"
></ImageButton>
<ImageButton android:layout_width="wrap_content" android:src="@drawable/icon" android:id="@+id/login_back" android:layout_height="50dip"
android:layout_marginLeft = "70dip" android:layout_marginRight = "10dip"></ImageButton>
</LinearLayout>
</LinearLayout>
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
//getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); setContentView(R.layout.login_dialog);
requestWindowFeature这个方法设置了没有标题。
我的背景是黑色图片的,在xml中写的。最外面多白色边框,打错了不是黑色边框。原本就只是我的xml显示就可以了,但是怎么去掉白色边框呢?