【发布时间】:2017-05-19 19:55:20
【问题描述】:
新年快乐。我在我的代码视图中设置了一个 floatingActionButton,但它没有在设计视图中显示该按钮。这里似乎有什么问题,我该如何解决?
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
tools:context=".MainActivity">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:clickable="true"
app:layout_anchor="@id/viewOne"
app:layout_anchorGravity="bottom|right|end"
app:rippleColor="#FFFFff" />
</android.support.design.widget.CoordinatorLayout>
</RelativeLayout>
【问题讨论】:
-
没有问题,您可以尝试通过删除
app:layout_anchor="@id/viewOne"来修复它 -
如果您说您的代码有问题,您需要添加该代码!!!!!
标签: android android-support-library floating-action-button