Android Question Difference DefaultDrawable and StateListDrawable buttons regarding button edge

RB Smissaert

Well-Known Member
Licensed User
Longtime User
Trying to place button on a panel and set the gap between those buttons.
Noticed there seems to be a difference between DefaultDrawable and StateListDrawable buttons as how the edge of the button shows on the panel.
These 2 layout scripts show the difference:

For StateListDrawable buttons this gives me the right button gaps:

B4X:
'8 buttons, left one is left anchored (left: 2) to the panel,
'which is anchored left And right (both 0) to the activity
btnZoomUp.Left = btnZoomDown.Left + (btnZoomDown.Width + 2dip)
btnCurrentLocation.Left = btnZoomUp.Left + (btnZoomUp.Width + 2dip)
btnMakeArea.Left = btnCurrentLocation.Left + (btnCurrentLocation.Width + 2dip)
btnAddAreaPoint.Left = btnMakeArea.Left + (btnMakeArea.Width + 2dip)
btnLocation.Left = btnAddAreaPoint.Left + (btnAddAreaPoint.Width + 2dip)
btnShowMapShapes.Left = btnLocation.Left + (btnLocation.Width + 2dip)
btnClearMarkers.Left = btnShowMapShapes.Left + (btnShowMapShapes.Width + 2dip)

But for DefaultDrawable buttons this script gives me the right button gaps:

B4X:
dButtonWidth = pnlDBBrowser.Width / 5 'pnlDBBrowser is anchored left and right (both 0) to the activity
btnDBBrowserPaste.Width = dButtonWidth
btnDBBrowserFields.Width = dButtonWidth
btnDBBrowserShow.Width = dButtonWidth
btnDBBrowserDrop.Width = dButtonWidth
btnDBBrowserOK.Width = dButtonWidth
btnDBBrowserShow.Left = pnlDBBrowser.Width / 2 - dButtonWidth / 2 'anchoring middle button
btnDBBrowserFields.Left = btnDBBrowserShow.Left / 2
btnDBBrowserDrop.Left = (btnDBBrowserShow.Left + btnDBBrowserOK.Left) / 2

The behaviour of StateListDrawable buttons is as I expected, but the behaviour of DefaultDrawable buttons is not as I expected as I expected the
above script to make the buttons having no gaps.

Any idea what I am missing here?

RBS
 
Top