Ещё одна реализация кнопки Floating Action Button для HMOS с множеством функций.
Добавьте com.github.clans.fab.FloatingActionButton
в файл макета XML.
<StackLayout
xmlns:ohos="http://schemas.huawei.com/res/ohos"
ohos:id="$+id:parent"
ohos:height="match_parent"
ohos:width="match_parent">
<ListContainer
ohos:id="$+id:list"
ohos:height="match_parent"
ohos:width="match_parent"/>
<com.github.clans.fab.FloatingActionButton
ohos:id="$+id:fabBtn"
ohos:height="match_content"
ohos:width="match_content"
ohos:bottom_margin="12vp"
ohos:fab_elevation="4vp"
ohos:image_src="$media:ic_menu"
ohos:layout_alignment="bottom|right"
ohos:right_margin="16vp"/>
</StackLayout>
<com.github.clans.fab.FloatingActionMenu
ohos:id="$+id:menu_green"
ohos:height="match_content"
ohos:width="match_content"
ohos:align_parent_bottom="true"
ohos:align_parent_right="true"
ohos:bottom_margin="10vp"
ohos:left_margin="10vp"
ohos:menu_animationDelayPerItem="500"
ohos:menu_colorNormal="#43A047"
ohos:menu_colorPressed="#2E7D32"
ohos:menu_icon="$media:ic_star"
ohos:right_margin="150vp"
ohos:top_margin="10vp"
>
<com.github.clans.fab.FloatingActionButton
ohos:height="match_content"
ohos:width="match_content"
ohos:fab_colorNormal="#43A047"
ohos:fab_colorPressed="#2E7D32"
ohos:fab_label="Menu item 1"
ohos:fab_size="1"
ohos:image_src="$media:ic_edit"/>
<com.github.clans.fab.FloatingActionButton
ohos:height="match_content"
ohos:width="match_content"
ohos:fab_colorNormal="#43A047"
ohos:fab_colorPressed="#2E7D32"
ohos:fab_label="Menu item 2"
ohos:fab_size="1"
ohos:image_src="$media:ic_edit"/>
<com.github.clans.fab.FloatingActionButton
ohos:height="match_content"
ohos:width="match_content"
ohos:fab_colorNormal="#43A047"
ohos:fab_colorPressed="#2E7D32"
ohos:fab_label="lorem_ipsum"
ohos:fab_size="1"
ohos:image_src="$media:ic_edit"/>
</com.github.clans.fab.FloatingActionMenu>
Способ 1: Сгенерируйте har-пакет из библиотеки и добавьте его в папку lib.
добавьте следующий код в gradle основного проекта
implementation fileTree(dir: 'libs', ```
include: ['*.jar', '*.har']
Метод 2: allprojects{ repositories{ mavenCentral() } } implementation 'io.openharmony.tpc.thirdlib:floatingactionbutton:1.0.0'
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
You can comment after Login
Inappropriate content may be displayed here and will not be shown on the page. You can check and modify it through the relevant editing function
If you confirm that the content does not involve inappropriate language/advertisement redirection/violence/vulgar pornography/infringement/piracy/false/insignificant or illegal content related to national laws and regulations, you can click submit to make an appeal, and we will handle it as soon as possible.
Comments ( 0 )