sunil
sunil

Reputation: 9681

Problem in Developing for multiple screen resolution in Android?

I want to develop Android applications which will support multiple screen resolutions. I have gone through support multiple screen resolution article.

I tried creating folder layout-hdpi and had one layout file in that. The layout file with similar name was in layout folder too. I changed certain values in layout file which was in layout-hdpi but that also changed the values in layout file which was in layout folder.

To be more specific the hierarchy is something like this

res | -->layout | --------> main.xml | -->layout-hdpi | --------> main.xml

Any change in the main.xml under layout-hdpi also changes the value in main.xml under layout.

Can someone let me know why is this happening?

Upvotes: 1

Views: 1485

Answers (2)

Adeel Pervaiz
Adeel Pervaiz

Reputation: 1356

I faced the same issue, I think you copied the actual layout and pasted it in other directory, some how IDEs map copied files and when you save them changes applies on all the copies.

Try restarting the IDE and it will be fixed.

Upvotes: 0

Daniel
Daniel

Reputation: 185

To have different layout files for different screen sizes, you have to name your folders like that:

res/layout/main.xml            // layout for normal screen size
res/layout-small/main.xml      // layout for small screen size
res/layout-large/main.xml      // layout for large screen siz

Just look at http://developer.android.com/guide/practices/screens_support.html

Upvotes: 3

Related Questions