问题
I've added xml code to have a floating action button on my screen (no functionality right now but will) but when I go onto the design view of xml, instead of showing the email icon image, it shows just text like 'floating action button': '
Could someone explain what I've done wrong?
the code I use:
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_dialog_email"
android:layout_gravity="bottom|end"
app:elevation="6dp"
app:pressedTranslationZ="12dp"/>
回答1:
It means the correct library is not added. Try adding design library
implementation 'com.android.support:design:27.1.1'
来源:https://stackoverflow.com/questions/51739465/floating-action-button-not-showing-image