Article,What is a Floating Label and how to work with it?
نوشته شده توسط : dotnek

In this tutorial, we want to apply settings that when the user wants to enter a value into EditText, the Hint in it is not removed and moved upwards like an animation. So, we knew that in EditText there are hints that if the user wants to enter some value, the Hint will be lost, and in this article, we want to apply the settings so that the Hint is moved upwards in animation.1- We create a new project in Android Studio with the desired name TextInputLayout.2- I create an Empty Activity type.3- We add the design library to the project. Like the following:

dependencies {
implementation fileTree (dir: 'libs', include: ['* .jar'])
implementation 'com. android. support: appcompat-v7:27.1.1'
implementation 'com. android. support:design:27.1.1'
}
4- We add two EditText to the project and Active dT to receive the username and password from the user.5- The codes that should be in the activity_main.xml section are as follows:

<? xml version = "1.0" encoding = "utf-8"?>
<LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android"
xmlns: tools = "http://schemas.android.com/tools"
android: layout_width = "match_parent"
android: layout_height = "match_parent"
android: orientation = "vertical"
tools: context = ". MainActivity">

<android. support. Design. widget. TextInputLayout
android: layout_width = "match_parent"
android: layout_height = "wrap_content"
android: id = "@ + id / user layout">

<EditText
android: layout_width = "match_parent"
android: layout_height = "wrap_content"
android: id = "@ + id / user_edittext"
android: hint = "Username" />

</android. support. Design. widget. TextInputLayout>


<android. support. Design. widget. TextInputLayout
android: layout_width = "match_parent"
android: layout_height = "wrap_content"
android: id = "@ + id / pass_layout">

<EditText
android: layout_width = "match_parent"
android: layout_height = "wrap_content"
android: id = "@ + id / pass_edittext"
android: hint = "Password"
android: input Type = "text Password" />

</android. support. Design. widget. TextInputLayout>

</LinearLayout>
6- EditText is placed inside the TextInputLayout tag.7- We will implement the project.8- After executing the project, we will see that the first EditText, which is related to receiving the username, is in Focus mode and is waiting to enter the value in it.9- Items that are in Focus mode, the Hint color inside it and the line below it is red and the rest are gray.10- If we want to define an item and apply settings that are in Focus mode, we do the following:

 

Read more on:https://www.dotnek.com/Blog/Apps/what-is-a-floating-label-and-how-to-work-with

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

Related link:Increase website ranking





:: برچسب‌ها: dotnek , seo , site ,
:: بازدید از این مطلب : 59
|
امتیاز مطلب : 0
|
تعداد امتیازدهندگان : 0
|
مجموع امتیاز : 0
تاریخ انتشار : سه شنبه 19 مرداد 1400 | نظرات ()
مطالب مرتبط با این پست
لیست
می توانید دیدگاه خود را بنویسید


نام
آدرس ایمیل
وب سایت/بلاگ
:) :( ;) :D
;)) :X :? :P
:* =(( :O };-
:B /:) =DD :S
-) :-(( :-| :-))
نظر خصوصی

 کد را وارد نمایید:

آپلود عکس دلخواه: