Search code examples
androidgraphical-layout-editor

Android layout editor devices not holding their place for each different layout


I am trying to design different layouts for different screen sizes. I have created layout files for sw240dp, and I am now trying to design layouts for sw480dp. My problem involves the list of devices in the layout editor. I am trying to select a 3.7 inch device to design on, but the software keeps jumping over to the sw240dp layout file every time I select the 3.7 inch device for sw480dp. I don't understand what I'm doing wrong here. Is there something wrong with my eclipse software, or am I doing something wrong?


Solution

  • What resolution and density are you selecting for the emulated device? The DP is determined by the density and resolution. So for 480 DP, here is the mapping from density to required pixel resolution:

    MDPI (160) : 480px
    HDPI (240) : 720px
    XHDPI(320) : 960px
    

    So if you're picking a 3.7" 480x800 device at HDPI, that's not going to fall into the sw480dp bucket. You'd need to create it as an MDPI device (i.e. density of 160).