public class CustomWebView extends WebView {
public CustomWebView(Context context) {
super(context);
}
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
InputConnection inputConnection = super.onCreateInputConnection(outAttrs);
outAttrs.inputType = InputType.TYPE_CLASS_PHONE;
return inputConnection;
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
Activity activity = new Activity();
View vwf = activity.getCurrentFocus();
InputMethodManager inputManager = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.restartInput(vwf);
setFocusable(true);
}
}//class
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="asv_lab.ru.smarttemp.MainActivity"
tools:showIn="@layout/main">
<GridLayout
android:id="@+id/gridmain"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:alignmentMode="alignMargins"
android:columnCount="4"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ProgressBar
android:id="@+id/prg0"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="60dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="10"
android:layout_column="1"
android:layout_row="1"
android:max="100"
android:progress="33"
android:progressDrawable="@drawable/prgbarv1" />
<ProgressBar
android:id="@+id/prg1"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="40dp"
android:layout_height="match_parent"
android:layout_column="1"
android:layout_gravity="center"
android:layout_row="1"
android:layout_weight="0.5"
android:max="100"
android:progress="34"
android:progressDrawable="@drawable/prgbarv" />
<EditText
android:id="@+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_row="2"
android:ems="3"
android:inputType="number" />
</GridLayout>
</android.support.constraint.ConstraintLayout>