Задать вопрос
Ответы пользователя по тегу Android
  • Как переключить режим клавиатуры с текстового на телефонный(только цифры)?

    @sergei_kot Автор вопроса
    Что то у меня не выходит ничего ( выскакивает текстовая клавиатура при вводе в поле input webview. Атрибут inputtype (html) с text на number поменять нельзя. Уважаемые специалисты как сделать что бы при вводе в < .input inputtype="text"> (страница загружена в webview) открывалась клавиатура с цифрами TYPE_CLASS_PHONE?
    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
    Ответ написан
    Комментировать
  • Как сделать два progressbar один за другим?

    @sergei_kot Автор вопроса
    Вот вроде то что нужно получилось, одна проблемка Edittext уходит за пределы экрана ( Внизу под progressbarom нужен edittext в который будет вводится температура. Помогите пожалуйста?
    <?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>
    Ответ написан
    Комментировать