Android Question B4A Numpad .... How to remove the thin line below the numbers

Diego Marcelo Croatto

Member
Licensed User
Hi to All.... the question is.... how remove the thin line below the entered numbers.... as it where a label in a Numpad?.... Thank's a lot!!!

https://www.b4x.com/android/forum/threads/customview-numpad.64191/#content


ThisLine.jpeg
 

William Lancee

Well-Known Member
Licensed User
Longtime User
@PassionDEV , I was a bit slow in testing the solution and missed your reply. It works here.

B4X:
    'After loading layout
    Sleep(0)
    Dim tempx As B4XView = Numpad1.GetBase.GetView(0)    'this is the floating text field on which the numpad is based
    Dim tempz As B4XView = tempx.GetView(1)                'this is the EditText view
    tempz.SetColorAndBorder(tempz.color, 0, 0, 0)        'this removes the border
 
Upvote 0

Diego Marcelo Croatto

Member
Licensed User
@PassionDEV , I was a bit slow in testing the solution and missed your reply. It works here.

Willam I can't find the similar code in the example.....

B4X:
    'After loading layout
    Sleep(0)
    Dim tempx As B4XView = Numpad1.GetBase.GetView(0)    'this is the floating text field on which the numpad is based
    Dim tempz As B4XView = tempx.GetView(1)                'this is the EditText view
    tempz.SetColorAndBorder(tempz.color, 0, 0, 0)        'this removes the border
Numpad.bas:
#DesignerProperty: Key: DecimalButton, DisplayName: Show Decimal, FieldType: Boolean, DefaultValue: True
#DesignerProperty: Key: Hint, DisplayName: Hint, FieldType: String, DefaultValue: Enter a number
#DesignerProperty: Key: AnimationDuration, DisplayName: Animation Duration, FieldType: Int, DefaultValue: 300
#DesignerProperty: Key: BackgroundColor, DisplayName: Background Color, FieldType: Color, DefaultValue: #CE222222
Sub Class_Globals
    Private EventName As String 'ignore
    Private CallBack As Object 'ignore
    Private mBase As Panel
    Private slidingPanel As Panel
    Private const spHeight = 265dip, spWidth = 176dip As Int
    Private side As Int
    Private const SIDE_UP = 1, SIDE_DOWN = 2, SIDE_LEFT = 3, SIDE_RIGHT = 4 As Int
    Private top, left As Int
    Private mProps As Map
    Private btnDecimal As Button
    Private flEditText1 As FloatLabeledEditText
    Private focused As Boolean
End Sub

Public Sub Initialize (vCallback As Object, vEventName As String)
    EventName = vEventName
    CallBack = vCallback
End Sub

Public Sub DesignerCreateView (Base As Panel, Lbl As Label, Props As Map)
    mBase = Base
    Dim parent As Panel = mBase.Parent
    slidingPanel.Initialize("")
    slidingPanel.Visible = False
    left = Min(mBase.Left + mBase.Width / 2 - 95dip, 100%x - spWidth)
    If 100%y - mBase.Top - mBase.Height - spHeight > 0 Then
        'below
        side = SIDE_DOWN
        top = mBase.Top + mBase.Height
    Else If mBase.Top > spHeight Then
        'above
        side = SIDE_UP
        top = mBase.Top - spHeight
    Else If mBase.Left + mBase.Width + spWidth < 100%x Then
        'right
        side = SIDE_RIGHT
        top = 100%y - spHeight
        left = mBase.Left + mBase.Width
    Else
        'left
        side = SIDE_LEFT
        top = 100%y - spHeight
        left = mBase.Left - spWidth
    End If
    parent.AddView(slidingPanel, left, top, spWidth, spHeight)
    mProps = Props
    CallSubDelayed(Me, "LoadPanelLayout")
End Sub

Private Sub LoadPanelLayout
    slidingPanel.LoadLayout("Numpad")
    slidingPanel.Elevation = 10dip
    Dim cd As ColorDrawable
    cd.Initialize(mProps.Get("BackgroundColor"), 3dip)
    slidingPanel.Background = cd
    btnDecimal.Visible = mProps.Get("DecimalButton")
    flEditText1.RemoveView
    flEditText1.EditText.InputType = flEditText1.EditText.INPUT_TYPE_NONE
    flEditText1.Hint = mProps.Get("Hint")
    mBase.AddView(flEditText1, 0, 0, mBase.Width, mBase.Height)
End Sub

Private Sub flEditText1_FocusChanged (HasFocus As Boolean)
    focused = HasFocus
    If HasFocus Then
        Show
    Else
        Hide
    End If
End Sub

Private Sub flEditText1_Click
    If focused Then Show
End Sub


Public Sub Show
    If slidingPanel.Visible Then Return
    If side = SIDE_UP Then
        slidingPanel.SetLayout(left, top + spHeight, spWidth, 0)
    else if side = SIDE_DOWN Then
        slidingPanel.SetLayout(left, top, spWidth, 0)
    Else If side = SIDE_LEFT Then
        slidingPanel.SetLayout(mBase.Left, top, 0, spHeight)
    Else If side = SIDE_RIGHT Then
        slidingPanel.SetLayout(mBase.Left + mBase.Width, top, 0, spHeight)
    End If
    
    slidingPanel.Visible = True
    slidingPanel.SetLayoutAnimated(mProps.Get("AnimationDuration"), left, top, spWidth, spHeight)
End Sub

Public Sub Hide
    slidingPanel.Visible = False
End Sub

Public Sub GetBase As Panel
    Return mBase
End Sub

Private Sub btnV_Click
    Hide
End Sub

Private Sub btnX_Click
    flEditText1.Text = ""
End Sub

Private Sub numpadButton_Click
    Dim b As Button = Sender
    If b.Text = "." And flEditText1.Text.Contains(".") Then Return
    flEditText1.Text = flEditText1.Text & b.Text
End Sub

Private Sub btnDel_Click
    If flEditText1.Text.Length > 0 Then
        flEditText1.Text = flEditText1.Text.SubString2(0, flEditText1.Text.Length - 1)
    End If
End Sub

Private Sub btnDel_LongClick
    flEditText1.Text = ""
End Sub

Public Sub getText As String
    Return flEditText1.Text
End Sub
Public Sub setText(s As String)
    If flEditText1.IsInitialized = False Then
        CallSubDelayed2(Me, "setText", s)
        Return
    End If
    flEditText1.Text = s
End Sub
 
Upvote 0

William Lancee

Well-Known Member
Licensed User
Longtime User
I am not sure what you are referring to.

I kind of see a very faint line above the baseline of the editText on the .jpeg image, but I don't see it on my screen.

My code removes the editText border after after loading layout (or it is initialized in code).
In my test, the name of the numpad is numpad1. The .GetBase is a method in the numpad class.
You do need to add the XUI library to use B4XView.


The baseline is removed by this code.
 
Last edited:
Upvote 0

Lucas Siqueira

Active Member
Licensed User
Longtime User
Hi to All.... the question is.... how remove the thin line below the entered numbers.... as it where a label in a Numpad?.... Thank's a lot!!!

https://www.b4x.com/android/forum/threads/customview-numpad.64191/#content


View attachment 112620


you can change the background color of edittext ..
add the XUI lib to your project ...

and add the lines:
Dim xui As XUI
Dim bb As B4XView = flEditText1.EditText
bb.SetColorAndBorder(xui.Color_Red,1dip,xui.Color_White,10dip)

1619929580716.png



B4X:
Private Sub LoadPanelLayout
    slidingPanel.LoadLayout("Numpad")
    slidingPanel.Elevation = 10dip
    Dim cd As ColorDrawable
    cd.Initialize(mProps.Get("BackgroundColor"), 3dip)
    slidingPanel.Background = cd
    btnDecimal.Visible = mProps.Get("DecimalButton")
    flEditText1.RemoveView
    flEditText1.EditText.InputType = flEditText1.EditText.INPUT_TYPE_NONE
    flEditText1.Hint = mProps.Get("Hint")
   
    Dim xui As XUI
    Dim bb As B4XView = flEditText1.EditText
    bb.SetColorAndBorder(xui.Color_Red,1dip,xui.Color_White,10dip)
   
    mBase.AddView(flEditText1, 0, 0, mBase.Width, mBase.Height)
End Sub
 
Upvote 0
Top