When the EditText control is close to the bottom, the soft keyboard pops up and obscures the EditText control that gets the focus. Input information is not visibleTo prevent this from happening, you need to set the properties of Androidmanifest.xmlThe preceding XML information is omitted to add Android:windowsoftinputmode= "Adjustpan" to the activity........................................................Android:windowsoftinputmode= "Adjustpan">
In the development of Android encountered problems in the solution, online search methods have some problems, so the following methods are usedMethod/Step
Add ID to activity layout fileXmlns:tools= "Http://schemas.android.com/tools"Android:layout_width= "Fill_parent"android:layout_height= "Fill_parent"android:scrollbars= "Vertical"Android:id= "@+id/activity_main">
Listen to events in the same way as normal controls.Activity_main= (LinearLayout
Many times in the project we need to use the input box Input,input focus will call the phone keypad, this time we if the current page maximum element width is the actual pixel, it is not a problem, but if the writing is hundred percent on the Android machine on the current page will be compressed upward, But mobile side we have to make adaptive, we can not write a fixed width high, then how to solve, first we could get the current mobile device width
This example describes the Android implementation pop-up keyboard code, is a very useful function. The code is very concise. Share to everyone for your reference.
The specific function code is as follows:
Timer timer = new timer ();
Timer.schedule (New TimerTask () {
@Override public
void Run () {
Inputmethodmanager m = (Inputmethodmanager) Edittext.getcontext (). Getsystemservice (Context.input_me
Home Home Button Main interface keyF2, PAGEUP Menu (soft-left) button left soft keySHIFT-F2, PAGEDOWN Star (soft-right) button right Soft keyESCAPE Back buttonF3 call/dial button dial/Call keyF4 hangup/endcall Button End CallF4 power button Supply keyF5 Search buttonKeypad_plus, Ctrl-f5 Volume up button Increase volume keyKeypad_minus, Ctrl-f6 Volume down button Decrease volume keyCtrl-keypad_5, CTRL-F3 camera buttonkeypad_7, ctrl-f11 switch to previous layout return keyKeypad_9, CTRL-F12 switch
Requestfoucs (); invalid.
Requestfoucsfromtouch (); invalid.
Webview.settouchlistener; invalid.
The problem lies in:
When inheriting WebView, note the construction method:
Public Commonwebview {
super (context);
Init ();
}
Public Commonwebview (context, AttributeSet attrs) {
Super (context, attrs);
Init ();
}
Public Commonwebview (context, AttributeSet attrs, int defstyleattr) {
Super (context, attrs, defstyleattr);
init ();
}
Defstyleattr can not pass 0, the following error writing:
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.