I have an Android application that needs to run on one specific device. Its display:
- is considered as ldpi (according to my calculations and getResources().getDisplayMetrics().densityDpi)
- has width of 1440px, from which Android should see only 940px.
When I call getResources().getDisplayMetrics().widthPixels it is really 940, but actually layout-w1140dp gets loaded, and not layout-w940dp (I have created several layout folders just to see what will be loaded).
The main issue I have is that even though I have set the width of my activity's main layout to be 940dp, what I observe is that it is actually filling like 3/4 of the screen width. It seems like Android resizes the drawables from the drawable-ldpi folder when displaying on a display with 940px width.
Am I getting it wrong to think that if you have the drawables and layout files for the specific display in the correct folders and in a layout you set 940dp, it should really be 940px on that display?
So I replaced every dp with px in my layout file and now it seems fine. Obviously I need to re-read more carefully Android's documentation, because I had wrong understanding of dp. I have some new questions, but I guess it will be better to ask in a separate questions.