無法在Android studio中加載具有未知錯誤的AppCompat ActionBar下面是我的xml文件。在預覽中有兩個錯誤“無法加載具有未知錯誤的AppCompat ActionBar”和“無法實現(xiàn)多個類”。怎么能運行app.But應(yīng)用程序崩潰,在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條經(jīng)驗 獲得超5個贊
在這個網(wǎng)站上發(fā)現(xiàn)它,它適用于我。修改/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條經(jīng)驗 獲得超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 關(guān)注
- 695 瀏覽
添加回答
舉報
0/150
提交
取消