Android Question Resize controls in view of customlistview. No ajust correct. What Anchor to do?

netsistemas

Active Member
Licensed User
Longtime User
how resize control for view correct in all phones and orientations
I have a layout, multiloades into customlistview for view a 'custom listview'.

i tray to change Anchor horizontal in PanelDetalle, and i can view the controls, but no resize correct.
if change to anchor horizontal = autoajust (all in designt layout), the controls are not visible.

attach demo

B4X:
#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region


'ABRIR LA RUTA DONDE ESTA EL IINSTALADOR:
'ide://run?File=%WINDIR%\System32\explorer.exe&Args=%PROJECT%\Objects

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private xui As XUI
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    Private lblPage0Cliente As Label
    Private lblFecha As Label
    Private cmdModificarParte As Button
    Dim Clv2 As CustomListView
    Private PanelDetalle As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout")
    
    Dim F As Int
    For f = 1 To 30
        Clv2.Add( CreateListItem(f),f)
    Next
    
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub CreateListItem( f As Int ) As Panel
    Dim p As B4XView = xui.CreatePanel("")
    p.LoadLayout("Layout_Detail")


'how resize control for view correct in all phones and orientations
'i tray to cahgne Anchor horizontal in PanelDetalle, and i can view the controls, but no resize correct.
'if change to anchor horizontal = autoajust (all in designt layout), the controls are not visible.
    p.SetLayoutAnimated(0, 0, 0,  Activity.Width,  PanelDetalle.Height)
    cmdModificarParte.Tag = f
    
    
    Return p
End Sub


Sub cmdModificarParte_Click
    Dim N As Int
    Dim Bt As Button
    Bt=  Sender
    n = Bt.tag
    Msgbox (n,"Valor tag")
End Sub
 

Attachments

  • DemoCarga.zip
    5.3 KB · Views: 131
D

Deleted member 103

Guest
Hi,
i tray to change Anchor horizontal in PanelDetalle, and i can view the controls, but no resize correct.
if change to anchor horizontal = autoajust (all in designt layout), the controls are not visible.
the anchor in your layout "Layout_Detail" is not set correctly.
You can / should a mixture with anchor and make script.
Or at least change the anchor from the panel "PanelDetalle", see my change.
 

Attachments

  • DemoCarga_01.zip
    11.3 KB · Views: 142
Upvote 0

netsistemas

Active Member
Licensed User
Longtime User
Thansk.
My errors was:

1# SetLayoutAnimated must be runner BEFORE loadlayou. (first and more importan error in my code)

B4X:
    p.SetLayoutAnimated(0, 0, 0,  Activity.Width, 155dip)
    p.LoadLayout("Layout_Detail")

2# Anchor on panel container (layout detail), must be correct UP/DOWN and LEFT/JOIN

3# Define layout detail (panels to replicate n times), in 320x155

4# Ensure and test SetLayoutAnimated for height correct (similar to right number en 3# . 320x155 -> 155)

Thanks filippo
 
Upvote 0
Top