нельзя использовать виды из библиотеки дизайна - PullRequest
0 голосов
/ 14 июня 2019

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

Я попытался загрузить SDK 28, и менеджер SDK сказал, что он загружен. Я попытался изменить его на 27.0.0 и получил ошибки при слиянии. Я пытался перейти на androidX, но тоже не удалось.

Домашняя деятельность

<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".feature.home_Activity.HomeActivity">

    <FrameLayout
        android:id="@+id/homeContainer"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" />

    <android.support.design.widget.BottomNavigationView
        android:id="@+id/navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="0dp"
        android:layout_marginEnd="0dp"
        android:background="?android:attr/windowBackground"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:menu="@menu/navigation" />

</LinearLayout>

build.gradle

 compileSdkVersion 28
    defaultConfig {
        applicationId "education.mahmoud.quranyapp"
        minSdkVersion 19
        targetSdkVersion 28
}

 def support_version = '28.0.0'

    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "com.android.support:appcompat-v7:$support_version"
    implementation "com.android.support.constraint:constraint-layout:1.1.3"
    implementation "com.android.support:support-v4:$support_version"
    implementation "com.android.support:design:$support_version"

должно запуститься приложение.

1 Ответ

0 голосов
/ 14 июня 2019

удалить ограничения в вашем BottomNavigationView

<android.support.design.widget.BottomNavigationView
    android:id="@+id/navigation"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginStart="0dp"
    android:layout_marginEnd="0dp"
    android:background="?android:attr/windowBackground"
    app:menu="@menu/navigation" />

или замените линейный макет родительского представления на макет consraint

<?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"
   tools:context=".feature.home_Activity.HomeActivity">

   <FrameLayout
       android:id="@+id/homeContainer"
       android:layout_width="match_parent"
       android:layout_height="0dp"
       android:layout_weight="1" />

   <android.support.design.widget.BottomNavigationView
       android:id="@+id/navigation"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:layout_marginStart="0dp"
       android:layout_marginEnd="0dp"
       android:background="?android:attr/windowBackground"
       app:layout_constraintBottom_toBottomOf="parent"
       app:layout_constraintLeft_toLeftOf="parent"
       app:layout_constraintRight_toRightOf="parent"
       app:menu="@menu/navigation" />

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