手记

EditText显示光标

            if (android.os.Build.VERSION.SDK_INT <= 10)
        {
            inputMoney.setInputType(InputType.TYPE_NULL);
        }
        else
        {
            getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
            try
            {
                Class<EditText> cls = EditText.class;
                Method setShowSoftInputOnFocus;
                setShowSoftInputOnFocus = cls.getMethod("setShowSoftInputOnFocus", boolean.class);
                setShowSoftInputOnFocus.setAccessible(true);
                setShowSoftInputOnFocus.invoke(inputMoney, false);
            } catch (Exception e)
            {
                e.printStackTrace();
            }
        }

原文链接:http://www.apkbus.com/blog-460955-59315.html

0人推荐
随时随地看视频
慕课网APP