EditText не виден внутри TextInputLayout - PullRequest
2 голосов
/ 22 мая 2019

У меня есть EditText, и он находится внутри TextInputLayout.Но проблема в том, что EditText не виден после развертывания на устройстве.Мой код ниже.

<TableRow
    android:id="@+id/tableRow2"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_height="match_parent"
        android:orientation="horizontal"
        android:layout_width="0dp"
        android:layout_weight="1">

        <android.support.design.widget.TextInputLayout
            android:id="@+id/textInputRFID"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginRight="5dp"
            android:layout_marginBottom="3dp"
            android:layout_weight=".70"
            android:orientation="horizontal">

            <EditText
                android:id="@+id/txtRFID"
                android:inputType="text"
                android:layout_weight=".70"
                android:layout_height="wrap_content"
                android:layout_width="0dp"
                android:hint="TAG ID"
                style="@style/textview_text" />
        </android.support.design.widget.TextInputLayout>

        <Button
            android:text="Start"
            android:id="@+id/BtnStartStop"
            android:background="@drawable/styl_blue_button"
            style="@style/textview_text"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight=".30" />
    </LinearLayout>
</TableRow>

Ответы [ 2 ]

3 голосов
/ 22 мая 2019

Причина в том, что вы устанавливаете layout_width в 0. Удалите layout_weight в editText элемент и измените layout_width на match_parent.

 <EditText
       android:id="@+id/txtRFID"
       android:inputType="text"
       android:layout_height="wrap_content"
       android:layout_width="match_parent"
       android:hint="TAG ID"/>
0 голосов
/ 22 мая 2019

Здесь вы используете ширину для редактируемого текста 0dp, который может создавать проблему, поэтому замените его на match_parent или wrap_content , как указано ниже:

<android.support.design.widget.TextInputLayout
                android:id="@+id/textInputRFID"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginRight="5dp"
                android:layout_marginBottom="3dp"
                android:layout_weight=".70"
                android:orientation="horizontal">
                <EditText
                    android:id="@+id/txtRFID"
                    android:inputType="text"
                    android:layout_weight=".70"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:hint="TAG ID"
                    style="@style/textview_text" />
            </android.support.design.widget.TextInputLayout>

Надеюсь, это сработает для вас.

...