Android 在focus EditText上关闭VM?
我面临一个特殊的问题。Android 在focus EditText上关闭VM?,android,android-edittext,android-dialog,android-keypad,android-runtime,Android,Android Edittext,Android Dialog,Android Keypad,Android Runtime,我面临一个特殊的问题。 在我的对话框中,我有一个EditText,当我聚焦它时,键盘出现并键入第一个单词,但我的应用程序很长时间没有响应,直到我关闭它。 这是我显示对话框的功能代码: public void ShowDialog(String url){ ViewGroup li = (ViewGroup) getLayoutInflater().inflate(R.layout.purchase_view, null); final TextView url_txt =
在我的对话框中,我有一个EditText,当我聚焦它时,键盘出现并键入第一个单词,但我的应用程序很长时间没有响应,直到我关闭它。
这是我显示对话框的功能代码:
public void ShowDialog(String url){
ViewGroup li = (ViewGroup) getLayoutInflater().inflate(R.layout.purchase_view, null);
final TextView url_txt = (TextView) li.findViewById(R.id.url_txtView);
url_txt.setText(url);
purchase_dialog = new Dialog(this, R.style.Theme_Transparent);
purchase_dialog.setContentView(li);
purchase_dialog.show();
}
和我的purchase\u view.xml
:<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:visibility="gone"
android:id="@+id/purchase_loadingbar">
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<RelativeLayout
android:id="@+id/lay_comment"
android:paddingBottom="15dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iconImgView"
android:src="@drawable/ic_launcher"
android:layout_alignParentRight="true"
android:layout_alignBottom="@+id/h_scroll"
android:layout_alignTop="@+id/h_scroll"
android:background="#0096aa"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<HorizontalScrollView
android:id="@+id/h_scroll"
android:layout_toLeftOf="@+id/iconImgView"
android:scrollingCache="false"
android:animationCache="false"
android:smoothScrollbar="true"
android:overScrollMode="never"
android:scrollbars="none"
android:background="#0096aa"
android:paddingTop="15dp"
android:paddingRight="15dp"
android:paddingLeft="12dp"
android:paddingBottom="5dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/url_txtView"
android:background="@android:color/white"
android:text="@string/dialog_title"
android:textStyle="bold"
android:textSize="17sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</HorizontalScrollView>
<LinearLayout
android:id="@+id/linear"
android:layout_below="@+id/h_scroll"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<WebView
android:layout_below="@+id/linear"
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
我的Logcat
错误:
06-23 15:49:15.188 15042-15042/com.chistarayaneh.avvalmarket.app D/AndroidRuntime﹕ Shutting down VM
06-23 15:49:15.188 15042-15042/com.chistarayaneh.avvalmarket.app W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x2b542210)
06-23 15:49:15.278 15042-15244/com.chistarayaneh.avvalmarket.app W/HardwareRenderer﹕ Attempting to initialize hardware acceleration outside of the main thread, aborting
提前感谢。不知道这是否会导致您的问题,但您的
onKey()
函数在所有情况下都会返回true
。。。这是正确的吗?@TripeHound是的,我不想对后退按钮采取任何行动。所以肯定只要返回true代码>函数体会做同样的事情吗?
06-23 15:49:15.188 15042-15042/com.chistarayaneh.avvalmarket.app D/AndroidRuntime﹕ Shutting down VM
06-23 15:49:15.188 15042-15042/com.chistarayaneh.avvalmarket.app W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x2b542210)
06-23 15:49:15.278 15042-15244/com.chistarayaneh.avvalmarket.app W/HardwareRenderer﹕ Attempting to initialize hardware acceleration outside of the main thread, aborting