Open StNekroman opened 7 years ago
Additionaly,
return (float) (DimenUtils.dpToPixels(mPaint.measureText(text)));
is not correct, because measureText output is already in pixels.
Although,
mPaint.setTextSize(baselineDropDownViewFontSize * bootstrapSize);
looks like isn't correct as well due to http://stackoverflow.com/questions/6232541/android-measuretext-return-pixels-based-on-scaled-pixels
For debugging needs I set up
<dimen name="bootstrap_dropdown_default_item_left_padding">0dp</dimen>
<dimen name="bootstrap_dropdown_default_item_right_padding">0dp</dimen>
in order to see clean width, without padding adn I got:
So, looks like, calculationo of item width is wrong from the begining even for "EUR", which was chosen as longest one.
Currently you calculate it as: measuretext(getLongestItemText()) + paddingLeft + paddingRight. But that it not corrent, because with of "WWW" will be longer then "iii", while length of both string is the same. In other words:![image](https://cloud.githubusercontent.com/assets/12896163/21750080/e34d9f36-d5b3-11e6-8649-8d87e02e1638.png)
And final result of bug is here:![device-2017-01-03-212645](https://cloud.githubusercontent.com/assets/12896163/21750085/f1a171fc-d5b3-11e6-88bf-2b515f183a3d.png)
In this case, my longest string was "EUR". But, as you see, even "EUR" doesn't fit in the line.