Android Soft Keyboard issues

Source: Internet
Author: User

One: Automatically get focus when edittexit
1, get the focus does not pop-up input box, hide the soft keyboard;

2, do not let the text box to get focus;

Method One:

Add to <activity> tag: Android:windowsoftinputmode = "Statehidden"

Method Two:

In the OnCreate ()

GetWindow (). Setsoftinputmode (WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN)

Method Three:

We can preempt the focus of a text box, such as joining in its parent form:
<linearlayout xmlns:android= "Http://schemas.android.com/apk/res/android"
Xmlns:tools= "Http://schemas.android.com/tools"
Android:layout_width= "Match_parent"
android:layout_height= "Match_parent"
android:orientation= "Vertical"
Android:focusable= "true"
Android:focusableintouchmode= "true"
Tools:context= ". Mainactivity ">
<edittext
Android:id= "@+id/etmsg"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
/>
</LinearLayout>

Second: The default pop-up keyboard mode is the numeric keypad.

EditText et = (EditText) Findviewbyid (r.id.editnum);
Et.setinputtype (Inputtype.type_class_number);
Set the input type Type_class_number for your edittext, so that when you click EditText, the default pop-up keyboard mode is the numeric keypad.

Android Soft Keyboard issues

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.