Android 呈现失败,出现已知错误FloatingActionButton
嗨,我从布局编辑器中得到这个渲染错误Android 呈现失败,出现已知错误FloatingActionButton,android,android-layout,floating-action-button,Android,Android Layout,Floating Action Button,嗨,我从布局编辑器中得到这个渲染错误 从晶圆厂移除背景色 已更改依赖项版本 使缓存无效/重新启动 再造晶圆厂 创建了一个新项目,并将FAB添加到新布局中。一切都很顺利 到目前为止,一切都没起作用。希望你能帮我解决这个错误 如果打开FloatingActionButton.java类,会出现一些导入错误,如屏幕截图所示 也许这就是错误的原因。但我还是不知道该怎么解决。最终我自己解决了。我不得不换线 <declare-styleable name="FloatingActionButton"
也许这就是错误的原因。但我还是不知道该怎么解决。最终我自己解决了。我不得不换线
<declare-styleable name="FloatingActionButton">
到
现在一切都好了 你在哪里叫晶圆厂按钮?另外,可能的解决方案是将
应用程序:
更改为android:
看看这是否适合您。我在我的工厂中使用onClick方法,所以我不给工厂打电话。我试过了,但没用。如果我将应用程序更改为android,则错误相同。然后确保使用AppCompatActivity
而不是Activity
,同时确保使用AppComapt
主题。另外,我的坏消息是,不要使用android:
使用app:
已经在使用AppCompatActivity
,主主题的父级是parent=“Base.Theme.AppCompat.Light.DarkActionBar”
。您能解释一下您的xml吗。你为什么不直接使用RelativeLayout而不是将其包装在一个布局中?太棒了,伙计!你真的让我开心。几个月前我还在找这个!
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="categoryHandler"
type="ci.ali.moneymaker.handlers.CategoryHandler" />
</data>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- our tablayout to display tabs -->
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
style="@style/AppTabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="fixed" />
<!-- View pager to swipe views -->
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/tabLayout"
android:background="@color/background_grey"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_add_account"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_margin="@dimen/fab_margin"
android:onClick="@{categoryHandler::addCategory}"
android:src="@drawable/ic_fab_add"
app:backgroundTint="@color/colorPrimaryLight"
app:elevation="2dp"
app:rippleColor="#99FFFFFF" />
</RelativeLayout>
</layout>
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'
})
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.android.support:recyclerview-v7:25.2.0'
compile 'com.android.support:support-v4:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
compile 'com.android.support:support-v4:25.2.0'
compile 'com.android.support:support-v13:25.2.0'
compile 'com.jakewharton.threetenabp:threetenabp:1.0.4'
compile 'net.objecthunter:exp4j:0.4.7'
compile 'com.github.PhilJay:MPAndroidChart:v3.0.1'
}
<declare-styleable name="FloatingActionButton">
<declare-styleable name="CustomFloatingActionButton">