EditText появляется в дизайне, но не в реальном apk - PullRequest
0 голосов
/ 15 ноября 2018

Это activity_main.xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    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"
>

<TextView
    android:id="@+id/label"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Text:"
   />

<EditText
    android:layout_toRightOf="@id/label"
    android:layout_toEndOf="@id/label"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:inputType="text"
    android:hint="type ur text here"
    android:layout_alignBaseline="@id/label"

    />
</RelativeLayout>

В Design на Android Studio можно увидеть как TextView, так и EditText, но после компиляции только TextViewвидимый.

Почему?

Скриншоты

Дизайн:

Design

Apk:

enter image description here

Спасибо

Styles.xml:

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
        <!-- Customize your theme here. -->
    </style>

</resources>

1 Ответ

0 голосов
/ 15 ноября 2018

Попробуйте этот код:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    android:orientation="horizontal"
    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"
    >

    <TextView
        android:id="@+id/label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Text:"
        />

    <EditText
        android:layout_weight="1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="text"
        android:hint="type ur text here"
        />
</LinearLayout
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...