developer tip

현재 테마에서 'coordinatorLayoutStyle'스타일을 찾지 못했습니다.

copycodes 2020. 11. 16. 21:41
반응형

현재 테마에서 'coordinatorLayoutStyle'스타일을 찾지 못했습니다.


최신 빌드 도구 (27) 및 유사한 API 레벨과 함께 최신 버전의 Android 스튜디오 (3.0)를 사용하고 있습니다.

레이아웃이 디자인 탭에서 렌더링되지 않고 특히 코디네이터 레이아웃을 사용하고 있다는 점에서 많은 문제가 발생합니다.

이 문제를 어떻게 해결합니까?


이 줄을 응용 프로그램 테마에 삽입하여이 렌더링 문제를 해결했습니다 (앱 테마는 일반적으로 styles.xml에 배치됨 ).

[ SDK 28 ]

<style name="AppTheme">
  <item name="coordinatorLayoutStyle">@style/Widget.Support.CoordinatorLayout</item>
</style>

[ SDK 27 ]

<style name="AppTheme">
  <item name="coordinatorLayoutStyle">@style/Widget.Design.CoordinatorLayout</item>
</style>

@Chris가 제안한대로. IDE가 Widget.Support 또는 Widget.Design 에서 CoordinatorLayout찾지 못하는 경우 "CoordinatorLayout"을 입력하기 시작하면 몇 가지 옵션이 제공됩니다.


SDK 28 은 새 프로젝트를 만들 때 안타깝게도 Android Studio에서이 오류를 발생시키는 것으로 나타 났습니다 .

해결 방법 :

귀하의 확인 build.gradle : (응용 프로그램 모듈) 파일을 변경 :

compileSdkVersion 28
targetSdkVersion 28

에:

compileSdkVersion 27
targetSdkVersion 27

또한 올바른 종속성 버전을 사용하고 있는지 확인하십시오.

implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'

implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'build.gradle(모듈) 에서 알파 3을 알파 1로 변경하십시오. 동기화하면 좋습니다. 나는 이것을 알아 내기 위해 거의 하루를 보냈다. 이 답변 중 어느 것도 나를 위해 일하지 않았습니다. 도움이 되었기를 바랍니다


나는 또한 같은 문제에 직면했다. 레이아웃 미리보기 창에서 테마를 변경하는 것과 같은 것은 나를 도왔습니다.

솔루션 : 다음으로 업데이트 build.gradle(app)했습니다.

dependencies {
    implementation 'com.android.support:appcompat-v7:27.0.2'
    implementation 'com.android.support:design:27.0.2'
}

하나 더:

compileSdkVersion 27
targetSdkVersion 27

 <style name="Theme.Shrine" parent="Theme.MaterialComponents.Light.NoActionBar">
    <item name="coordinatorLayoutStyle">@style/Widget.Support.CoordinatorLayout</item>
</style>

재료 테마를 추가하십시오.


Android Studio 3.1.4 사용자의 경우 : 표시된 답변을 시도했지만 작동하지 않았습니다. 이 줄 삽입 :

<style name="AppTheme.NoActionBar">
   <item name="coordinatorLayoutStyle">@style/Widget.Design.CoordinatorLayout</item>
</style>

응용 프로그램 테마에 추가해도 렌더링 문제가 해결되지 않으므로 변경을 취소했습니다.

솔루션 : build.gradle (Module : app) 파일에서 다음과 같이 변경했습니다.

변경 전 :

android {
   compileSdkVersion 28
      defaultConfig {
         targetSdkVersion 28
      }
   }
}

dependencies {
   implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
   implementation 'com.android.support:design:28.0.0-rc01'
}

변경 후 :

android {
   compileSdkVersion 27
      defaultConfig {
         targetSdkVersion 27
      }
   }
}

dependencies {
   implementation 'com.android.support:appcompat-v7:27.1.1'
   implementation 'com.android.support:design:27.1.1'
}

그것은 나를 위해 완벽하게 작동했습니다. 도움이 되길 바랍니다.


응답 해 주셔서 감사합니다. 코드를 수정 한 솔루션을 찾았습니다.

나는 tools:showInviewpager로 옮긴 조각의 부모 레이아웃에서 속성을 활성화했으며 이전에는 호스트 활동에 포함되었지만 lint는 그것을 포착하지 못했습니다.


나는 그것이 안드로이드 스튜디오 3.0 이상에서 일반적인 문제라고 생각합니다. 바라건대 그들은 다음 업데이트를 고칠 것입니다. Android Studio Preview 3.2에서는 잘 작동합니다. Android Studio 미리보기 다운로드 여기에 이미지 설명 입력


따로, Android Studio의 디자인 뷰에서 styles.xml 파일에 다음을 추가하면 :

<style name="Coordinator">
    <item 
    name="coordinatorLayoutStyle">@style/Widget.Design.CoordinatorLayout</item>
</style>

레이아웃의 xml 리소스 파일에서 CoordinatorLayout에 다음을 추가합니다.

<android.support.design.widget.CoordinatorLayout
    android:theme="@style/Coordinator"
    android:orientation="vertical"
    android:id="@+id/sample_layout_id"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/sample_background"
    tools:theme="@style/Coordinator">

그런 다음 적어도 디자인 뷰는 누락 된 coordinatorLayoutStyle 오류 생성을 중지합니다.


내 Android 스튜디오 버전 3.1.3.
모든 SDK 버전 28 제거 작업을하고 있습니다.
단계는 Open SDK Manager> SDK Platforms> Show package Details> Untick SDK 28> apply and Create new project입니다.


동일한 문제가 있지만 Android 스튜디오 3.1.4에서

그래서 처음에는 build.gradle에서 다음을 수행했습니다.

이것을 교체하십시오 :

구현 'com.android.support:appcompat-v7:28.0.0-rc01'

구현 'com.android.support:design:28.0.0-rc01'

구현 'com.android.support:support-v4:28.0.0-rc01'

그것으로:

구현 'com.android.support:appcompat-v7:28.0.0-alpha1'

구현 'com.android.support:design:28.0.0-alpha1'

구현 'com.android.support:support-v4:28.0.0-alpha1'

그러나 프로젝트를 재 구축 한 후에도 문제가 다시 반복됩니다.

그래서 저는 이렇게했습니다.

내 프로젝트 gradle.build입니다.

buildscript {
    ext.kotlin_version = '1.2.41'
    ext.android_support = '27.1.1'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

그리고 여기 앱 build.gradle

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "*****.******"//Replace with your own ID
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'

    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.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'
}

그리고 이것은 내 문제를 해결합니다.

감사합니다


답변을 게시하겠습니다 다른 답변은 작동하지만 아무도 미리보기 버전을 다운로드 할 필요가 없으며 Action Bar없이 머티리얼 디자인을 수행하는 것은 Android Studio로 앱 개발 시작 하는 방법이 아닙니다. Android Studio
의 버전은 3.1.4입니다. 기본 API 수정은 API 26으로 다운 그레이드하는 것입니다. 파일-> 프로젝트 구조를 클릭 한 다음 속성 탭에서 을 강조 표시 한 다음 Sdk 버전을 API 26으로 컴파일합니다. 이제 Falavors TAB을 클릭하고 Target Sdk 버전을 26으로 변경 한
다음 빌드에서 .gradle (module : app) 다음 변경 사항 추가

implementation 'com.android.support:appcompat-v7:27.0.0'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'

ToolBar 사용 방법을 배우기 위해 Google의 느린 FIX를 항상 정당화 할 수있을 것 같습니다.


This maybe existing issue: https://issuetracker.google.com/issues/37048767

Render using other versions of Android (say Android API 22).

Or check for any typos or invalid XML entries.

Refer here: Missing styles. Is the correct theme chosen for this layout?


<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="coordinatorLayoutStyle">@style/Widget.Design.CoordinatorLayout</item>
</style>

just add coodrinatorLayoutStyle as an item in style.xml and it worked for me.


Just Change implementation 'com.android.support:appcompat-v7:28.0.0-alpha3' and 'com.android.support:design:28.0.0-alpha3' to alpha 1. That's how i solved the problem.


I solve this problem when update all SDK tools in IDE and update Android Studio to 3.2.1


its working for me try it

   compileSdkVersion 28
        defaultConfig {
            minSdkVersion 16
            targetSdkVersion 28
           }

 implementation 'com.android.support:appcompat-v7:28.0.0'
 implementation 'com.android.support:design:28.0.0'

This is sdk 28 issue

Check your build.gradle (Module: app) file and change:

compileSdkVersion 28

targetSdkVersion 28

To:

compileSdkVersion 27

targetSdkVersion 27

참고 URL : https://stackoverflow.com/questions/49292487/failed-to-find-style-coordinatorlayoutstyle-in-current-theme

반응형