As their name suggests, the hide button is a float that is placed on the page whendesigning or developing an application-by-application designers and developers, and of course, it should be noted that by scrolling the page, they do not move and remain on the page. Of course, the choice of their location is the responsibility of the developers. These types of buttons are mostly used in messaging applications or their management such as Gmail. In this part of the tutorial, we want to tell you about how to create floating buttons.The Gmail pagehas a circular icon at the bottom right of the page with a pencil mark inside. Pressing this button will take you to the email page and write a new message.FAB stands for Floating Action Button, which requires some libraries to launch and run, such as appcompat and design.1- I willcreate a new project in Android Studioand we will choose a name for it. The name chosen for this project in this part of the tutorial is FAB.2- Remember that we must create the project with MinSDK 17.3- We add the library to the project. Like the following:

dependencies {
implementation fileTree (dir: 'libs', include: ['* .jar'])
implementation 'com. android. support: appcompat-v7:27.0.2'
implementation 'com. android. support:design:27.0.2'
}
In this project we use CoordinatorLayout for layout. It should be noted that the reason for using this layout is that you can use it to have better management and controls.


xmlns: android = "http://schemas.android.com/apk/res/android"
xmlns: app = "http://schemas.android.com/apk/res-auto"
xmlns: tools = "http://schemas.android.com/tools"
android: layout_width = "match_parent"
android: layout_height = "match_parent"
tools: context = "com.dotnek.fab. MainActivity">



Convert the activity_main.xml to CoordinatorLayout using the code listed above.4- Add a FloatingActionButton tag to android. Support.Design. widget. FloatingActionButton.


xmlns: android = "http://schemas.android.com/apk/res/android"
xmlns: app = "http://schemas.android.com/apk/res-auto"
xmlns: tools = "http://schemas.android.com/tools"
android: layout_width = "match_parent"
android: layout_height = "match_parent"
tools: context = "com.dotnek.fab. MainActivity">

android: id = "@ + id / fab"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content"
android: layout_gravity = "bottom | end"
android: layout_margin = "16dp"
android: src = "@ android: drawable / ic_dialog_email" />


The above code defines two values for layout_gravity. Bottom and end value. layout_margin also specifies the amount of distance it should have from the page, and the standard value to be included in the attribute is 16dp.5- We will implement the project.6- After executing the project, we will see that the button with the icon that we have defined will be displayed at the bottom right.7- If we want to move the floating button to the left, we must define layout_gravity as follows:

android: layout_gravity = "bottom | start"

8- start is opposite to end, which means the beginning of the screen.9- We will run the project again.10-FAB background coloris received and determined by default using colorAccent.11- In order to be able to change the background color, we must also change the property of app: background Tint. Like the following:

Read more on:https://www.dotnek.com/Blog/Apps/what-are-floating-buttons-in-android-systems

link:https://dotnek.mystrikingly.com/

Related link:DotNek IOS Vyacute;voj

How to start learning Android development

Android article,How to work with cameras on Android devices in two ways

Android article,What are BroadcastReceiver in Android systems, why and how to use them?

Android article,What are floating buttons in Android systems and how can they be used?

Android article,How can we change the font in Android and how to solve different problems?

Android article,What are snackbars in Android systems and how can they be used?

Android article,What are the services in Android systems and when are they used?

the ,to ,we ,and ,of ,in ,the page ,the project ,of the ,we will ,it should ,layout gravity bottom ,android support design

مشخصات

آخرین ارسال ها

آخرین جستجو ها


الان بخر تحویل بگیر جراح مغز و استخوان زد گیم صنایع رباتیک پایا www.payaelc.ir مطالب اینترنتی راهنمای خرید بانوان تجارت الکترونيک - E-commerce pouyafaraz2021 Clark's page مقاله و تحقیق جدید
دزدگ