макет ограничения не может правильно работать на API 21, 22? - PullRequest
0 голосов
/ 27 мая 2018

Я занимаюсь разработкой приложения для Android Studio с минимальной версией SDK 21, нацеленной на 26, хорошо работает на всех версиях, кроме версии 21, 22.см. мой снимок экрана

https://ibb.co/mGLhLo <- снимок экрана </p>

вот мои зависимости для макета ограничения:

implementation 'com.android.support.constraint:constraint-layout:1.0.2'

вот мой код компоновки xml:

<?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"
android:background="@drawable/bg_tc_right"
tools:context="online.monita.monita.MainActivity">

<View
    android:id="@+id/myRectangleView"
    android:layout_width="300dp"
    android:layout_height="200dp"
    android:layout_marginBottom="8dp"
    android:layout_marginEnd="8dp"
    android:layout_marginStart="8dp"
    android:background="@drawable/bg_rectangle_white_fade"
    app:layout_constraintBottom_toBottomOf="@+id/login"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="@+id/in_username" />

<TextView
    android:id="@+id/app_name"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginBottom="24dp"
    android:layout_marginTop="8dp"
    android:fontFamily="sans-serif-smallcaps"
    android:shadowColor="#fff"
    android:shadowDx="5"
    android:shadowDy="-5"
    android:text="@string/app_name"
    android:textColor="@android:color/black"
    android:textSize="35sp"
    app:layout_constraintBottom_toTopOf="@+id/myRectangleView"
    app:layout_constraintHorizontal_bias="0.5"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/iv_logo_pp"
    app:layout_constraintVertical_bias="0.06999999" />

<EditText
    android:id="@+id/in_username"
    android:layout_width="wrap_content"
    android:layout_height="46dp"
    android:layout_marginEnd="8dp"
    android:layout_marginStart="8dp"
    android:layout_marginTop="32dp"
    android:ems="10"
    android:hint="Username"
    android:inputType="textPersonName"
    app:layout_constraintBottom_toTopOf="@+id/in_password"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.5"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/myRectangleView"
    app:layout_constraintVertical_bias="0.52" />

<EditText
    android:id="@+id/in_password"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginEnd="8dp"
    android:layout_marginStart="8dp"
    android:layout_marginTop="12dp"
    android:ems="10"
    android:hint="Password"
    android:inputType="textPassword"
    app:layout_constraintBottom_toTopOf="@+id/login"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.5"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/in_username" />

<Button
    android:id="@+id/login"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginEnd="8dp"
    android:layout_marginStart="8dp"
    android:layout_marginTop="16dp"
    android:background="@drawable/btn_yellow"
    android:elevation="14dp"
    android:text="Login"
    app:layout_constraintBottom_toTopOf="@+id/myRectangleView"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.5"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/in_password" />

<ImageView
    android:id="@+id/iv_logo_pp"
    android:layout_width="100dp"
    android:layout_height="100dp"
    android:layout_marginBottom="16dp"
    android:layout_marginEnd="8dp"
    android:layout_marginStart="8dp"
    android:layout_marginTop="32dp"
    app:layout_constraintBottom_toTopOf="@+id/app_name"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.5"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:srcCompat="@drawable/logo_pp" />

<ProgressBar
    android:id="@+id/progressBar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:layout_marginEnd="8dp"
    android:layout_marginStart="8dp"
    android:layout_marginTop="8dp"
    android:visibility="gone"
    app:layout_constraintBottom_toBottomOf="@+id/myRectangleView"
    app:layout_constraintEnd_toEndOf="@+id/myRectangleView"
    app:layout_constraintStart_toStartOf="@+id/myRectangleView"
    app:layout_constraintTop_toTopOf="@+id/myRectangleView" />

</android.support.constraint.ConstraintLayout>

Заранее спасибо, извините за мой плохой английский и мой первый пост.

...