Android Question clvTree resizeTree?

tsteward

Well-Known Member
Licensed User
Longtime User
I have a need to manually change the height of the custom list view that contains the clvTree view but the tree view no longer fills the CLV.

How might I fix this?
 
Solution
Add these two lines after the CLV size changes:
B4X:
CustomListView1.Base_Resize(CustomListView1.AsView.Width, CustomListView1.AsView.Height)
CustomListView1.Refresh

Tip:
B4X:
If small = False Then
        small = True
        CustomListView1.AsView.Top = (Button1.Top + Button1.Height)+20dip
        CustomListView1.AsView.Height = Root.Height - ((Button1.Top + Button1.Height)+20dip)
        Label1.Visible=False
    Else
        small = False
        CustomListView1.AsView.Top = (Label1.Top + Label1.Height)+20dip
        CustomListView1.AsView.Height = Root.Height - ((Label1.Top + Label1.Height)+20dip)
        Label1.Visible=True
    End If
You can write like this:
B4X:
If small = False Then
        CustomListView1.AsView.Top =...

tsteward

Well-Known Member
Licensed User
Longtime User
I have used some colour to see what's happening.
I no longer try resizing the CLV and it is on a panel.
When I resize the panel the CLV does not resize automatically with it for some reason.
I can manually set the height of the CLV to the panel height which works but the treeCLV then does not fill the CLV

Panel background is red
CLV background is green
 

Attachments

  • Screenshot 2022-09-04 184153.png
    18.6 KB · Views: 132
  • Screenshot_20220904-184827.jpg
    275.3 KB · Views: 132
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
test;
code:
B4X:
    CustomListView1.DefaultTextBackgroundColor = xui.Color_Transparent
    Tree.Initialize(CustomListView1)
Customlistview

 
Upvote 0

tsteward

Well-Known Member
Licensed User
Longtime User
In my app I want to see the dividers.
You can see in my screenshot the tree does not fill the CLV as the green background of the CLV is visible at the bottom.
 
Upvote 0

tsteward

Well-Known Member
Licensed User
Longtime User
When you click on Button1 it resizes the Customlistview
I have changed the colour of the background so you can see it.
Then when you click Button1 again it puts it back.
It appears the tree does not fill the CLV

Or I don't understand and could use some help please.
 

Attachments

  • CLVTreeTS.zip
    23.4 KB · Views: 113
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Add these two lines after the CLV size changes:
B4X:
CustomListView1.Base_Resize(CustomListView1.AsView.Width, CustomListView1.AsView.Height)
CustomListView1.Refresh

Tip:
B4X:
If small = False Then
        small = True
        CustomListView1.AsView.Top = (Button1.Top + Button1.Height)+20dip
        CustomListView1.AsView.Height = Root.Height - ((Button1.Top + Button1.Height)+20dip)
        Label1.Visible=False
    Else
        small = False
        CustomListView1.AsView.Top = (Label1.Top + Label1.Height)+20dip
        CustomListView1.AsView.Height = Root.Height - ((Label1.Top + Label1.Height)+20dip)
        Label1.Visible=True
    End If
You can write like this:
B4X:
If small = False Then
        CustomListView1.AsView.Top = (Button1.Top + Button1.Height)+20dip
        CustomListView1.AsView.Height = Root.Height - ((Button1.Top + Button1.Height)+20dip)
    Else
        CustomListView1.AsView.Top = (Label1.Top + Label1.Height)+20dip
        CustomListView1.AsView.Height = Root.Height - ((Label1.Top + Label1.Height)+20dip)
    End If
Small = Not(Small)
Label1.Visible = Not(small)
 
Upvote 0
Solution
Cookies are required to use this site. You must accept them to continue using the site. Learn more…