Android Tutorial FloatLabeledEditText (ViewsEx)

upload_2016-2-28_15-46-20.png


FloatLabeledEditText is an improved EditText where the hint moves to the top instead of disappearing when there is text in the field.

With the floating hint you no longer need to add a label to describe the field.

The implementation is based on this open source project: https://github.com/wrapp/floatlabelededittext

It is implemented as a custom view. You need to add it from the designer. Note that you can change the text properties.

SS-2016-02-28_15.54.34.png


Technically FloatLabeledEditText wraps an EditText. You can get this EditText with the EditText property.
This is useful if you want to configure the internal EditText.

This library is part of the ViewsEx library (v1.10+). It is supported by Android 4+ and requires B4A v5.8+.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Anyone know how to set the typeface for the Hint. Edittext hint is working alright but the Floatlabel hint is not set.
The code in this post shows you how to access the hint label: https://www.b4x.com/android/forum/threads/floatlabelededittext-viewsex.64062/#post-406791

Hy, is possible set multiline?
B4X:
FloatLabeledEditText1.EditText.SingleLine =  False
FloatLabeledEditText1.EditText.Gravity = Bit.Or(Gravity.TOP, Gravity.LEFT)
 

luciano deri

Active Member
Licensed User
Longtime User
I need disable any input view in a activity (Button, RadioButton, EditText and
FloatLabeledEditText)
I think do
B4X:
For i = 0 To Activity.NumberOfViews - 1Dim v AsView
v = Activity.GetView(i)
v.enabled = false
Next
But FloatLabeledEditText not disabled because i must do FloatLabeledEditText.edittext.enabled = false.
How can disable all FloatLabeledEditText without set this one by one?
 

LucaMs

Expert
Licensed User
Longtime User
B4X:
For Each v As View In Activity.GetAllViewsRecursive
    If GetType(v) = "com.wrapp.floatlabelededittext.FloatLabeledEditText" Then
        Dim FLET As floatlabelededittext = v
        FLET.EditText.Enabled = False
    Else
        Try
             v.Enabled = False
        Catch
             LogColor(GetType(v), Colors.Blue)
        End Try
    End If
Next

NOT TESTED !
 

luciano deri

Active Member
Licensed User
Longtime User
B4X:
For Each v As View In Activity.GetAllViewsRecursive
    If GetType(v) = "com.wrapp.floatlabelededittext.FloatLabeledEditText" Then
        Dim FLET As floatlabelededittext = v
        FLET.EditText.Enabled = False
    Else
        Try
             v.Enabled = False
        Catch
             LogColor(GetType(v), Colors.Blue)
        End Try
    End If
Next

NOT TESTED !
No, code pass by this if but floatlabelededittext is ever enabled :(
 
Last edited:

Mashiane

Expert
Licensed User
Longtime User
Hi

Just a small issue, when you "set" a value to this control, the Floating Label disappears/hides e.g.

txtFL.text = "AAAA"

it only shows the floating label when you start typing text.

Also I have used the method to set the hint color, mine is always Gray and does not become black as set.

Any advice please.
 

doncx

Active Member
Licensed User
Longtime User
How can I make the Numpad larger? I'd like it to almost fill the screen.

I've looked high and low, through the various sources, but am missing something. Where do spWidth and spHeight come from? I'm not able to set the layout, height, or width of slidingPanel.
 

Leni Berry

Active Member
Licensed User
Longtime User
how to change FloatLabeledEditText1's height dinamically when text height increase in multiline mode....?
 

M.LAZ

Active Member
Licensed User
Longtime User
i saw some apps use a FloatLabeledEditText with RTL Side also with hint animation.. is that still not possible?
and how to change the color of the below line in the edittext
 

DonManfred

Expert
Licensed User
Longtime User
Top