My problem is very simple. I have a button that have 100dp marginRight and 100dp marginTop in a xxhdpi density screen. The problem is, when I change to another density screen or size, the button its not in position I want. It remains the 100dp margin top and right but I don’t won’t this. I thought that if I use dp, when I change screen it’s was going to be in the position I want, calculate de position in smaller or bigger screens. I hope you understand, I don’t want to create a layout for every density or size screen. How can position a button that be in the same position in every screen?
Asked
Active
Viewed 93 times
0
-
Not clear what you're asking, but it would be helpful to read up on what a dp is http://developer.android.com/guide/practices/screens_support.html – tachyonflux May 20 '15 at 19:27
-
http://stackoverflow.com/questions/2025282/difference-between-px-dp-dip-and-sp-in-android – tachyonflux May 20 '15 at 19:37
-
My background image have a square. I need the button be inside that square. In xxhdpi if i put 100 dp margin top and right it fix wright. The problem is if I change the screen size, the button its outside the square. I dont know hot to do this for all screens... understand? – user3240604 May 22 '15 at 13:33
1 Answers
0
on a different screen density that 100dp will change position. what you can do is support multiple size and create different layout for each.
read http://developer.android.com/guide/practices/screens_support.html.
Using the new size qualifiers is a solution.

Ray Ray
- 19
- 1
-
My background image have a square. I need the button be inside that square. In xxhdpi if i put 100 dp margin top and right it fix wright. The problem is if I change the screen size, the button its outside the square. I dont know hot to do this for all screens... understand? – user3240604 May 22 '15 at 13:33
-
you have to create different layouts for different density read the link that i posted. go to the section of "new size qualifiers". understand? – Ray Ray May 22 '15 at 19:47