i have a general view called view0, inside this i have 3 views view1, view2, view3. the layout in view0 is horizontal, then view1 width is 60% view2 20% and view3 20.
the first issue is view3 when width is 20% is not showed. i had to change width to 15%.
the second issue is in view2 and view3 i have images in vertical layout but when i run the app in emulator and device sometimes the images are diferent sizes or scratched and if i run the app again sometimes in other happens the same!!
Any clue?
1 Answer
Accepted Answer
I know exactly why your first issue happens: if you specify a dimension in percentage, the percentage is taken from the parent view's dimension. If that value is non-integer, it is rounded up.
So for example, if you have a view that is 486 pixels wide, and you have 4 subviews of width='25%', the views will each get a width of 122, which will cause the last view to not be shown. On different devices or emulators, where the screen size is different, you may have views that show on one device but not on another.
As for your second issue, I'm not quite sure I understand it, but I think what your'e describing is also a result of different screen densities and screen sizes. If you have a picture that is 200 pixels wide and you show it on a device with screen density mdpi, it will be physically larger than if you display it on a device with density xhdpi. You have to compensate for these differences in your code, either by specifying different dimensions in pixels for the different densities, or by using density independent pixels.
Your Answer
Think you can help? Login to answer this question!