关闭焦点EditText上的VM?

时间:2015-06-23 09:15:24

标签: 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 = (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_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>

注意:网页视图加载有多个文本输入的网址。

注意:我在显示对话框之前和之后也使用此代码,但我的问题没有解决:

purchase_dialog.getWindow().clearFlags(
                    WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
                            | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

我的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



在此先感谢。

0 个答案:

没有答案
相关问题