Android Question Is 85%y + 15%y equal 100%y ?

somed3v3loper

Well-Known Member
Licensed User
Longtime User
Hi
I know it should be a weird question but when I add a view (Panel , I did not test other views) with its Top at 85%y and its height being 15%y , It seems there is a tiny space of activity left not covered with the panel.
I am using code like this
B4X:
Activity.AddView(pnl1,0,85%y,100%x,15%y)

Am I missing something or a better method of adding views to activity?

Thanks in advance
 

Informatix

Expert
Licensed User
Longtime User
Hi
I know it should be a weird question but when I add a view (Panel , I did not test other views) with its Top at 85%y and its height being 15%y , It seems there is a tiny space of activity left not covered with the panel.
I am using code like this
B4X:
Activity.AddView(pnl1,0,85%y,100%x,15%y)

Am I missing something or a better method of adding views to activity?

Thanks in advance

15%y + 85%y is not exactly equal to 100%y because of the roundings but the difference should be no more than 1 pixel.
 
Upvote 0

somed3v3loper

Well-Known Member
Licensed User
Longtime User
It should fill the whole activity.
Try the following code:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   Dim pnl1 As Panel
   pnl1.Initialize("")
   pnl1.Color = Colors.Red
   Activity.AddView(pnl1,0,85%y,100%x,15%y)
End Sub
It is the same

15%y + 85%y is not exactly equal to 100%y because of the roundings but the difference should be no more than 1 pixel.

Thanks guys for replying


Is it a good idea to add 1dip like this

B4X:
Activity.AddView(pnl1,0,85%y,100%x,15%y+1dip)


?
 
Upvote 0
Top