#java #android
#java #Android
Вопрос:
Я новичок в разработке Android с использованием Java, я пробовал просматривать сеть, но безрезультатно. Как называется библиотека, которую я могу использовать для создания расширяемой плавающей кнопки действия, подобной той, что на рисунке ниже.
Пожалуйста, помогите.
Ответ №1:
Я просматривал некоторые исходные коды. Я нашел лучшую расширяемую FAB (плавающую кнопку действия)
Позвольте мне добавить эти исходные коды. Добавьте ее в build.gradle
implementation 'com.nambimobile.widgets:expandable-fab:1.0.2'
Добавьте следующий исходный код в макет
<!-- This is NOT a root view, but should be a child of whatever root view you
choose (CoordinatorLayout, ConstraintLayout, etc) -->
<com.nambimobile.widgets.efab.ExpandableFabLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The next 3 Views will only display in portrait orientation -->
<com.nambimobile.widgets.efab.Overlay
android:layout_width="match_parent"
android:layout_height="match_parent"
app:overlay_orientation="portrait"/>
<com.nambimobile.widgets.efab.ExpandableFab
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginBottom="@dimen/ui_margin_medium"
android:layout_marginEnd="@dimen/ui_margin_medium"
android:layout_marginRight="@dimen/ui_margin_medium"
app:efab_orientation="portrait"/>
<com.nambimobile.widgets.efab.FabOption
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:fab_orientation="portrait"
app:label_text="Portrait Option 1"
android:onClick="onClickPortraitOption1"/>
<!-- The next 3 Views will only display in landscape orientation -->
<com.nambimobile.widgets.efab.Overlay
android:layout_width="match_parent"
android:layout_height="match_parent"
app:overlay_orientation="landscape"/>
<com.nambimobile.widgets.efab.ExpandableFab
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginBottom="@dimen/ui_margin_medium"
android:layout_marginEnd="@dimen/ui_margin_medium"
android:layout_marginRight="@dimen/ui_margin_medium"
app:efab_orientation="landscape"/>
<com.nambimobile.widgets.efab.FabOption
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:fab_orientation="landscape"
app:label_text="Landscape Option 1"
android:onClick="onClickLandscapeOption1"/>
</com.nambimobile.widgets.efab.ExpandableFabLayout>
Затем вы можете использовать эти FAB, как вы используете кнопку on в файле Java.
Позвольте мне добавить эту ссылку
Комментарии:
1. @Terre, если это правильный ответ для вас. Затем вы можете пометить его как правильный ответ. Таким образом, другие могли легко найти ответ