Android Question Base_Resize

mrossen

Active Member
Licensed User
Longtime User
Hi,

When I use this code on my Samsung S4 tablet the whole layout can be displayed.

On my Samsung S20 the last 10 % in the bottom is missing and I can not scroll to see it.

I have tried to change the customview height to fit the panel height in the layout with this code without no luck :

B4X:
CLVcandatatest.Base_Resize(100%x, PanelcanTestMain.Height)

B4X:
    Dim fr2_xui As XUI
    Dim fr2_pnl As B4XView = fr2_xui.CreatePanel("")
    
    fr2_pnl.Color = Colors.Transparent
    fr2_pnl.SetLayoutAnimated(400, 0, 0, 100%x, 100%y)
            
    CLVcandatatest.add(fr2_pnl, Activity)
    fr2_pnl.LoadLayout("candatatestpage")
 

stevel05

Expert
Licensed User
Longtime User
If you use anchors in the layout you shouldn't need to change the customview height in code. Check they are set correctly.
 
Upvote 0

mrossen

Active Member
Licensed User
Longtime User
I have set the anchors like this

anc.JPG
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
What about the parent, or is it straight on the activity?
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Hang on, bottom edge distance looks wrong, it should be 0 to fill the screen. -388 will be below the bottom of the screen.
 
Upvote 0

mrossen

Active Member
Licensed User
Longtime User
B4X:
PanelMain.Initialize(0)
    tse.Initialize 'to Initialize the class'
    
    
    Activity.LoadLayout("main")
    
    TabStripMain.LoadLayout("clvcandataview", "CanBus Data")
    
    fr1_pnl = fr1_xui.CreatePanel("")
    
    fr1_pnl.color = Colors.Transparent
    fr1_pnl.SetLayoutAnimated(400, 0, 0, 100%x, 100%y)
    
        
    CLVcandataview.add(fr1_pnl, Activity)
    fr1_pnl.LoadLayout("candataviewpage")
        
    TabStripMain.LoadLayout("clvcandatatest", "Test Data")
    
    Dim fr2_xui As XUI
    Dim fr2_pnl As B4XView = fr2_xui.CreatePanel("")
    
    fr2_pnl.Color = Colors.Transparent
    fr2_pnl.SetLayoutAnimated(400, 0, 0, 100%x, 100%y)
            
    CLVcandatatest.add(fr2_pnl, Activity)
    fr2_pnl.LoadLayout("candatatestpage")
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Without being able to test it I am guessing, but you are setting the height of the panel to 100%y, which is the screen height. Is this really what you want? If TabstripMain is a TabHost, then the tabs will be taking some of the screen.
 
Upvote 0

mrossen

Active Member
Licensed User
Longtime User
I am confused,

I want to set the height to 100%y in the scrollable panel to be able to scroll the loaded layout completly
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
As I said, I am guessing, if you want to post an example project I may be able to help but there are too many variables and possible reasons to visualize.
 
Upvote 0

mrossen

Active Member
Licensed User
Longtime User
I have made this example.

As you ca see I can not scroll down the entire page.
 

Attachments

  • TabTest.zip
    334.4 KB · Views: 119
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You are not using CLV correctly. Why aren't you adding 4 items?

The anchors are not set correctly. Panel1 in 'input' layout should be anchored to the top and the item size should be explicitly set:
B4X:
fr1_pnl.SetLayoutAnimated(400, 0, 0, 100%x, 900dip)

'fr1_pnl.Height = 1000dip
   
CLV1.add(fr1_pnl,Activity)
fr1_pnl.LoadLayout("input")
You should also remove AutoScaleAll as the variant size doesn't match the actual size.

And set targetSdkVersion to 29.
 
Upvote 0

mrossen

Active Member
Licensed User
Longtime User
Thank you Erel,

It was AutoScaleAll that was my problem. I had not tried to remove that. The other I have tried.
 
Upvote 0
Top