Макет ограничения работает аномально в API 22 - PullRequest
0 голосов
/ 25 января 2019

При использовании Ограничительный макет все действия в телефоне, поддерживаемом API 22, выходят за рамки, тогда как на других уровнях API выше 22 он выглядит идеально. Минимальный уровень SDK приложения - 21. I не могу понять, почему это происходит, поскольку Макет ограничения прекрасно поддерживается API 22.

Схема раздуваемая

<?xml version="1.0" encoding="utf-8"?>  
<androidx.constraintlayout.widget.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:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="80dp">

<de.hdodenhof.circleimageview.CircleImageView
        android:id="@+id/user_image_recycler_inflated_main_activity"
        android:layout_width="70dp"
        android:layout_height="70dp" app:layout_constraintEnd_toEndOf="parent"
        android:layout_marginEnd="8dp" app:layout_constraintStart_toStartOf="parent"
        android:layout_marginStart="8dp" android:layout_marginBottom="8dp"
        app:layout_constraintBottom_toBottomOf="parent" android:layout_marginTop="8dp"
        app:layout_constraintTop_toTopOf="parent" app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintVertical_bias="0.095"
        tools:src="@drawable/ic_person_black_24dp"
/>
<TextView
        android:layout_width="233dp"
        android:layout_height="29dp"
        android:id="@+id/username_recycler_inflated_main_activity" app:layout_constraintEnd_toEndOf="parent"
        android:layout_marginEnd="8dp"
        app:layout_constraintStart_toEndOf="@+id/user_image_recycler_inflated_main_activity"
        android:layout_marginStart="8dp"
        app:layout_constraintTop_toTopOf="@+id/user_image_recycler_inflated_main_activity"
        app:layout_constraintHorizontal_bias="0.017"
        android:layout_marginTop="4dp"
        android:textColor="#000"
        android:hint="Username"
/>
<TextView
        android:layout_width="233dp"
        android:layout_height="29dp"
        android:id="@+id/email_recycler_inflated_main_activity"
        android:layout_marginStart="8dp"
        app:layout_constraintEnd_toEndOf="@+id/username_recycler_inflated_main_activity"
        android:layout_marginBottom="4dp"
        app:layout_constraintBottom_toBottomOf="@+id/user_image_recycler_inflated_main_activity"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintStart_toStartOf="@+id/username_recycler_inflated_main_activity"
        android:layout_marginTop="8dp"
        app:layout_constraintTop_toBottomOf="@+id/username_recycler_inflated_main_activity"
        android:textColor="#000"
        android:hint="timestamp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

gradle (Модуль: приложение)

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

androidExtensions {
    experimental = true
}

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.two.pilots.messengerappkotlin"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'

//  Firebase
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-firestore:17.1.5'
implementation 'com.google.firebase:firebase-storage:16.0.5'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-database:16.0.5'

//  circle image view
implementation 'de.hdodenhof:circleimageview:2.2.0'

//  picasso
implementation 'com.squareup.picasso:picasso:2.71828'

//  groupie
implementation 'com.xwray:groupie:2.3.0'
implementation 'com.xwray:groupie-kotlin-android-extensions:2.3.0'

//  image compressor
implementation 'id.zelory:compressor:2.1.0'

implementation 'androidx.recyclerview:recyclerview:1.0.0'
}

apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android-extensions'

API 22, API 24, API 26 соответственно

enter image description here

Ответы [ 2 ]

0 голосов
/ 27 января 2019

Изменить ширину TextViews как 0dp.Ничего плохого в работе с Gradle.Проблема с макетом.Это не отзывчиво.

0 голосов
/ 26 января 2019

Трудно понять, просто посмотрев на изображение, но я не думаю, что это из-за уровня API, но это может быть связано с разным размером экрана между устройствами, на которых вы тестировали свое приложение.

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

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...