无法在Android studio中加载具有未知错误的AppCompat ActionBar下面是我的xml文件。在预览中有两个错误“无法加载具有未知错误的AppCompat ActionBar”和“无法实现多个类”。怎么能运行app.But应用程序崩溃,在Logcat中没有显示错误。<?xml version="1.0" encoding="utf-8"?><android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="506dp" />
<LinearLayout
android:id="@+id/layout_main"
android:orientation="vertical"
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:weightSum="1"
tools:context=".Activity.MainActivity">
<LinearLayout
android:id="@+id/main_layout"
android:orientation="vertical"
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:layout_weight="0.7"
tools:context=".Activity.MainActivity">
<!-- our tablayout to display tabs -->
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
app:tabMode="scrollable"
app:tabSelectedTextColor="@color/colorBlack"
app:tabTextColor="@color/colorWhite"
/>
3 回答
慕斯709654
TA贡献1840条经验 获得超5个赞
在这个网站上发现它,它适用于我。修改/res/values/styles.xml来自:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"></style>
至:
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar"></style>
开满天机
TA贡献1786条经验 获得超13个赞
方法1:
定位 /res/values/styles.xml
更改
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
至
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
方法2:
修改模板文件(定位:android-studio/plugins/android/lib/templates/gradle-projects/NewAndroidModule/root/res/values/styles.xml.ftl
)
更改
backwardsCompatibility!true>Theme.AppCompat<#else><#if
至
backwardsCompatibility!true>Base.Theme.AppCompat<#else><#if
- 3 回答
- 0 关注
- 672 浏览
添加回答
举报
0/150
提交
取消