при добавлении пустой строки спиннер не отображается правильно - PullRequest
0 голосов
/ 31 марта 2019

Я показываю счетчик в строке просмотра. Когда я добавляю пустую строку с помощью кнопки «Добавить участника», счетчик показывается наполовину, как показано ниже: enter image description here

Пожалуйста, помогите мне. Я поиск в Google, но я не нашел никакого решения вот макет для этого экрана

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="10dp">

    <TextView
        android:id="@+id/txt_numbertitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:letterSpacing="0.01"
        android:lineSpacingExtra="2sp"
        android:text="First Member"
        android:textColor="#424242"
        android:textSize="16sp" />

    <ImageView
        android:id="@+id/img_delete"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:srcCompat="@drawable/ic_delete"
        android:layout_alignParentRight="true"/>
</RelativeLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="20dp"
    android:orientation="horizontal">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1.0">

        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="20dp">

            <EditText
                android:id="@+id/edt_name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginRight="20dp"
                android:backgroundTint="@color/colorPrimary"
                android:hint="First Name"
                android:inputType="text"
                android:maxLines="1"
                android:textColor="@color/textcolor"
                android:textColorHint="@color/hintcolor" />

        </android.support.design.widget.TextInputLayout>

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1.0">

        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="20dp">

            <EditText
                android:id="@+id/edt_surname"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:backgroundTint="@color/colorPrimary"
                android:hint="Last Name"
                android:inputType="text"
                android:maxLines="1"
                android:textColor="@color/textcolor"
                android:textColorHint="@color/hintcolor" />

        </android.support.design.widget.TextInputLayout>

    </LinearLayout>

</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="bottom"
    android:orientation="horizontal">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1.0">

        <Spinner
            android:id="@+id/sp_relation"
            style="@style/Widget.AppCompat.Spinner.Underlined"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginRight="5dp"
            android:backgroundTint="@color/colorAccent"
            android:dropDownVerticalOffset="35dp"
            android:entries="@array/relation"
            android:spinnerMode="dropdown"
            android:theme="@style/ThemeSpinner" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1.0">

        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <EditText
                android:id="@+id/edt_city"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:backgroundTint="@color/colorPrimary"
                android:hint="City"
                android:inputType="text"
                android:maxLines="1"
                android:textColor="@color/textcolor"
                android:textColorHint="@color/hintcolor" />

            </android.support.design.widget.TextInputLayout>

        </LinearLayout>
    </LinearLayout>

</LinearLayout>

вот макет строки повторного просмотра. Когда данные заполнены массивом, счетчик отображает правильный счетчик, но когда я добавляю пустую строку, он отображается как на изображении ниже

 <style name="ThemeSpinner">
    <!-- Color when pressed -->
    <item name="colorAccent">#ffa000</item>
    <!-- Default color for the dropdown arrow and line -->
    <item name="colorControlNormal">#ffc107</item>
    <item name="android:textColor">@color/colorPrimaryDark</item>
</style>

вот тема, примененная к блесне

1 Ответ

0 голосов
/ 31 марта 2019

Попробуйте изменить значение layout_height на wrap_content.

Если пользовательский фон - это файл в формате xml, убедитесь, что в нижней части вы не используете отступы.

...