I know there are plenty of materials about my question. But I'm still confused how to design android app to support difference sizes of screen.
Mostly when I design web, I use percent to support different size of screens. But as you know, in android, in order to do that, I have to make UI in realtime using Java code(read width and height and resize all the Views depending on screen size), because with XML, you can't do this. But this seems not right.
I have image files(PNG, JPG), and I arrange these files as ImageView and scaleType as "fitXY" and I set width as DP. I know that "dp" unit will make this element consistently same real size and for this reason people use it for widgets. So I put this image in xxxhdpi screen and when I see in xhdpi screen, image is so huge that the image is cut.
What I want is very simple. I want to arrange View elements as percent to width so that layout is very similar in different screens(different height ratio will be resolved with scroll maybe?). But I don't know how to...???? Not only percent.. I just want to know normal process of generating image files and arranging widgets for different screens...
Should I make many image files for different screen and put these in res/drawable-xxxxx ? If I do this, does android system use different files for different screen automatically? Or, Should I make many layouts for each different screen all the time(this seems stupid..)?
Could anyone guide me please?... I have been looking for this answer more than 1 week. Please...
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…