gpt4 book ai didi

java - 在当前主题中找不到样式 'navigationViewStyle'

转载 作者:太空狗 更新时间:2023-10-29 16:10:48 27 4
gpt4 key购买 nike

我使用下面的代码添加 DrawerLayout 但在设计 View 中给我以下呈现问题。我看不到我的 DrawerLayout

Failed to find style '**navigationViewStyle**' in current theme

这是我的代码

<?xml version="1.0" encoding="utf-8"?>
<!-- Use DrawerLayout as root container for activity -->
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">

<!-- Layout to contain contents of main body of screen (drawer will slide over this) -->
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<!-- Container for contents of drawer - use NavigationView to make configuration easier -->
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true" />

</android.support.v4.widget.DrawerLayout>

我的gradle文件

apply plugin: 'com.android.application'

android {
compileSdkVersion 28
buildToolsVersion "28.0.0"
defaultConfig {
applicationId "com.example.mohammadkhalili.kelaket"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:28.+'
compile 'com.android.support.constraint:constraint-layout:1.+'
testCompile 'junit:junit:4.12'
compile 'com.android.support:recyclerview-v7:28.+'
compile 'com.squareup.okhttp3:okhttp:3.11.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'junit:junit:4.12'
compile 'com.github.bumptech.glide:glide:3.8.0'
compile 'de.hdodenhof:circleimageview:1.1.0'
compile 'com.android.support:design:28.+'
compile 'com.android.support:support-v4:28.+'
compile 'com.android.support:cardview-v7:26.0.0-alpha1'
}

list 文件

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mohammadkhalili.kelaket" >

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"

>
<activity android:name=".Splash" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>



<activity android:name=".loginpackage.RegisterActivity"/>
<activity android:name=".loginpackage.ForgetPassActivity" />
<activity android:name=".mainfilmpage.MainListFilmActivity" />
<activity android:name=".mainfilmpage.MainFilmActivity" />
<activity android:name=".loginpackage.login"/>


</application>

</manifest>

最佳答案

这个问题是28版本的bug,唯一的解决方法是compileSdkVersion使用27版本。

为此,您应该使用:

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

build.gradle 中:

android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.your app name"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
lintOptions {
checkReleaseBuilds false
abortOnError false
}
aaptOptions{
cruncherEnabled = false
}
}
buildTypes {
release {

minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

}
}

关于java - 在当前主题中找不到样式 'navigationViewStyle',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51798242/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com