1-无法加载未知错误的AppCompat ActionBar。
2-无法在当前主题中找到样式“ floatingActionButtonStyle”。
Xml文件显示了以上两个错误以及以下内容-
1-缺少样式。是否为此布局选择了正确的主题?使用布局上方的“主题”组合框选择其他布局,或修复主题样式引用。
2-无法实例化以下类: -android.support.v7.widget.ActionBarContainer
-android.support.v7.widget.ActionBarContextView
-android.support.v7.app.WindowDecorActionBar
-android.support.design.widget.TextInputLayout
classpath是:
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.2'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-beta01'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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'
//add library
implementation 'com.android.support:design:28.0.0-beta01'
implementation 'com.firebaseui:firebase-ui-database:4.1.0'
}
apply plugin: 'com.google.gms.google-services
XML文件-
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp"
tools:context=".MainActivity">
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
android:src="@drawable/ic_send"
android:id="@+id/fab"
android:tint="@android:color/white"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
app:fabSize="mini"
/>
<android.support.design.widget.TextInputLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_toLeftOf="@+id/fab"
android:layout_alignParentBottom="true"
android:layout_toStartOf="@+id/fab"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
>
<EditText
android:id="@+id/input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Message..."
android:inputType="text" />
</android.support.design.widget.TextInputLayout>
<ListView
android:id="@+id/list_of_message"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_above="@+id/fab"
android:dividerHeight="16dp"
android:divider="@android:color/transparent"
android:layout_marginBottom="16dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true">
</ListView>
</RelativeLayout>
答案 0 :(得分:0)
粘贴这两个依赖项
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
代替
implementation 'com.android.support:design:28.0.0-beta01'
implementation 'com.android.support:appcompat-v7:28.0.0-beta01'
测试版引起了问题。