Android Question How Set variant height in SetLayoutAnimated in diferend device (solved)

netsistemas

Active Member
Licensed User
Longtime User
I have this code
B4X:
private Sub AddPanelDetalleLineas
    'Layout_PedidosLineasDetalle
    Dim F As Long
  
    Try
      
    For f = 1 To 8
        Dim p As B4XView = Xui.CreatePanel("")
        p.SetLayoutAnimated(0, 0, 0,   Activity.Width  ,   310dip)
        p.LoadLayout("Layout_PedidosLineasDetalle")
        'set valores a los controles

         lblPedidoLineaNumero.Text =f
      
         B4XPedidoLineaPartida.Text = F
         B4XComboPedidoLineaEtiqueta.SetItems (ListaEtiquetas)
         B4XPedidoLineaUnidades.Text = F
         B4XPedidoLineaDescripcion.Text  = F  &  " Descripcion Ejemplo"


            CLVPedidoLineas.Add( p,PanelLineasDetalleEnHoja3 )
    Next
        ContaLineas = f
    Catch
        Log(LastException)
    End Try

End Sub

the problem is that 310dip are good in one device, but very height in others
how determine and set the correct height for all devices?


that is:
how set the correct height for every device?

(panel height for Layout_PedidosLineasDetalle are 190 . Attach image)
 

Attachments

  • imgb4x.jpg
    246.5 KB · Views: 201
  • imgb4x_2.jpg
    219.4 KB · Views: 188
  • Captura de pantalla 2022-06-16 113754.jpg
    274.2 KB · Views: 194
Last edited:

netsistemas

Active Member
Licensed User
Longtime User
but this panel are add to CustomListview.
In every device, the height are diferent. I try to get CLV (CustomListView).GetBase.Height and divice into ?¿?¿??
but i don't know how determine this idel heidht of panel.
 
Upvote 0

netsistemas

Active Member
Licensed User
Longtime User
in any device the perfect are 5 in other 3
i go to create a new variant, but the question now are other.
how determine then panel.height by code, and what screen variant are loaded (may be this is for other trhead)
 
Upvote 0

Sagenut

Expert
Licensed User
Longtime User
Your items have a minimum height?
To get the CLV height use

B4X:
CLV.AsView.Height
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Your items have a minimum height?
That I think is the determining factor: set the minimum height for each item, expressed in dips (create the item in the Designer).

Once this is done you have two alternatives:

1 - don't care about the number of items that will be displayed
2 - make a calculation and resize the CLV to the maximum height with the maximum integer number of items that can be displayed.
 
Upvote 0

netsistemas

Active Member
Licensed User
Longtime User
solved.
For me, the solution was add
p.setlayoutnamated bofore (logical) AND AFTER loadlayout.


B4X:
        p.SetLayoutAnimated(0, 0, 0,    CLVPedidoLineas.AsView.Width,   mItemHeight )
        p.LoadLayout("Layout_PedidosLineasDetalle")
        p.SetLayoutAnimated(0, 0, 0, CLVPedidoLineas.AsView.Width, PanelLineasDetalleEnHoja3.Height)

aditional, in second proyect a put a textbox instead button, for view the keyboard,and, MAGIAL, the items go up and the keyboard are not over the Customlistview.
In my proyect, i nedd add a ime events controls for move the customlisview.
This is only one comment, for view, may by, in other theath

THANSK lucaMs and sagenunt
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…