Android Question CustomlistView, how to set same Divider Height across devices?

incendio

Well-Known Member
Licensed User
Longtime User
Hi all,

I have a CustomListView (ver 1.2) with Divider height = -5, the display on a 7" tablet with 1280x800 and a 5.2" phone with 1980x1080 are different. (see attachments)

On a phone, I have to set Divider Height = -20 to get about same result with the tablet.

Is that possible to get same divider height across multiple device?

Thanks in advance.
 

Attachments

  • phone_ss.jpg
    phone_ss.jpg
    50.3 KB · Views: 246
  • Tablet_ss.jpg
    Tablet_ss.jpg
    27.5 KB · Views: 238

incendio

Well-Known Member
Licensed User
Longtime User
Yes, setting height with designer, attached is the project.
 

Attachments

  • menu.zip
    26.7 KB · Views: 166
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. The layout should start from the top (3.bal).
2. The item's height is incorrect. It should be 80dip.
3. The divider height should be a positive number.
4. It is better to remove AutoScaleAll from the items layout.
5. You should pass the height to AddMenu and set the panel's height:
B4X:
Private p As Panel
p.Initialize("")
Activity.AddView(p, 0, 0, Width, Height)
p.LoadLayout("3")
p.RemoveView
 
Upvote 0

incendio

Well-Known Member
Licensed User
Longtime User
Found the problem !!

It was the panel position on layout 3 that made a gap, its value was 10, changed to 0 solved the problem.

Item's height seem has no effect. With these code, everything seem works fine
B4X:
    Private p As Panel
    p.Initialize("")
    Activity.AddView(p, 0, 0, Width, 0)
    p.LoadLayout("3")
    p.RemoveView
End Sub

Thansk for you help.
 
Upvote 0
Top