Все мои элементы разрешены в моих файлах .xml макета - PullRequest
0 голосов
/ 06 января 2019

ImageView, TextView, LinearLayout и т. Д. Если я фокусирую курсор на элементе, я вижу "Элемент ImageView / View / TextView ... здесь не разрешен ..."

Если я начинаю писать "TextV", IDE не говорит мне о таких параметрах, как "TextView"

Если я нажал кнопку «дизайн», мой макет показывает. И я могу построить свое приложение, и оно работает.

screenshot_1

screenshot_2

screenshot_3

screenshot_4

Я пытался: очистить сборку, перестроить, удалить кеш, сделать недействительным кеш, удалить папку ".idea", но у меня есть эта проблема.

Мой .xml файл, например:

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:id="@+id/all_content_items"
    android:layout_height="wrap_content"
    android:background="#ffffff">

    <ImageView
        android:id="@+id/avatar"
        android:layout_width="32dp"
        android:layout_height="32dp"
        android:layout_marginStart="16dp"
        android:layout_centerVertical="true"
        android:src="@mipmap/container_orange_new" />

    <ImageView
        android:id="@+id/viewed"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@mipmap/point"
        android:layout_alignParentEnd="true"
        android:layout_marginEnd="16dp"
        android:layout_marginTop="37dp"/>



    <TextView
            android:id="@+id/number_order"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="16dp"
        android:layout_toEndOf="@id/avatar"
            android:layout_marginTop="16dp"
            android:text="Уведомление по контейнеру"
            android:textColor="#033E30"
            android:alpha="0.48"
            android:textSize="12sp" />


    <TextView
        android:id="@+id/date_creation"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:layout_marginRight="15dp"
        android:layout_marginStart="279dp"
        android:alpha="0.48"
        android:text="контейнер"
        android:textColor="#033E30" />

    <TextView
        android:id="@+id/count_of_containers"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toEndOf="@id/date_creation"
        android:textColor="#033E30"
        android:layout_marginTop="16dp"
        android:layout_marginLeft="14dp"
        android:text="2"
        android:textSize="12sp"
        android:textAlignment="textEnd"/>



    <TextView
        android:id="@+id/textNotification"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/number_order"
        android:layout_toEndOf="@id/avatar"
        android:text="Транспортировка в Пекин"
        android:paddingEnd="20dp"
        android:layout_marginTop="2dp"
        android:layout_marginStart="16dp"
        android:textColor="#000000"
        android:textSize="16sp" />


    <View
        android:layout_width="match_parent"
        android:layout_height="2dp"
        android:layout_below="@id/textNotification"
        android:layout_alignParentStart="true"
        android:layout_marginStart="0dp"
        android:layout_marginTop="12dp"
        android:background="#c6d8d3">

    </View>
</RelativeLayout>

Мой .gradle файл:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "com.royallogistics.yegor.royallogistics"
        minSdkVersion 20
        targetSdkVersion 28
        versionCode 3
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

        debug {
            resValue("string", "PORT_NUMBER", "8080")

        }
    }
    compileOptions {
        sourceCompatibility = '1.8'
        targetCompatibility = '1.8'
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    packagingOptions {
        exclude 'META-INF/rxjava.properties'
    }
}


dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-vector-drawable:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.squareup.retrofit2:retrofit:2.5.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'
    implementation 'com.squareup.retrofit2:adapter-rxjava2:2.5.0'
    implementation 'com.squareup.retrofit2:converter-scalars:2.0.1'
    implementation 'com.melnykov:floatingactionbutton:1.3.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'io.reactivex.rxjava2:rxjava:2.2.0'
    implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
    debugImplementation 'com.amitshekhar.android:debug-db:1.0.4'
    implementation "com.android.support:support-fragment:28.0.0"
    implementation 'com.github.esafirm.android-image-picker:imagepicker:1.13.1'
    implementation 'com.github.esafirm.android-image-picker:rximagepicker:1.13.1'
    implementation 'com.github.bumptech.glide:glide:4.8.0'

}

Когда я синхронизирую проект с файлами gradles, это нормально. Как это исправить?

Ответы [ 2 ]

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

попробуйте импортировать ваш проект снова, эта проблема может быть решена

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

Добавить

xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"

к вашему корневому элементу. Если это не сработает, попробуйте Invalidate Caches / Restart на вкладке File

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