I am puzzled why I cannot adjust the width of a HolizontalScrollView to make a clean fit every time. I have a varying number of columns of digits with a fixed width (10%x, but 80dip gives the same result) so that 10 columns fit on the screen. If there are more than 10 columns I need to scroll horizonally to see the additional columns. That all works fine. But I want to be able to adjust the width of the HorizontalScrollView so that the colums fit exactly no matter how many there are. I am working with a screen 1200x1848 /1.5 in portrait format.
My first attempt: I set the dip value of the HorizontalScrollView at NumberofColumns*80dip. 10 columns gives 800dip = 1200 pixels. But no, the value is to low, it doesn't scroll. By trial and error I found that 12 columns require a value of 1752dip - a perfect fit, so I change my calculation to NumberofColumns*146dip. But why should it be 146dip? For me it makes no sense. That works fine for 11,12,13 columns, but the more columns I have the more empty space I have at the end of the horizontal scroll. It seems that the value 146dip is too large after all, but if I reduce the figure to, say, 140dip then the 12th column is no longer accessible. I must have missed a vital point along the way, but no idea where. Can anyone help?
My first attempt: I set the dip value of the HorizontalScrollView at NumberofColumns*80dip. 10 columns gives 800dip = 1200 pixels. But no, the value is to low, it doesn't scroll. By trial and error I found that 12 columns require a value of 1752dip - a perfect fit, so I change my calculation to NumberofColumns*146dip. But why should it be 146dip? For me it makes no sense. That works fine for 11,12,13 columns, but the more columns I have the more empty space I have at the end of the horizontal scroll. It seems that the value 146dip is too large after all, but if I reduce the figure to, say, 140dip then the 12th column is no longer accessible. I must have missed a vital point along the way, but no idea where. Can anyone help?