everyone,I have a problem. I want to layout a view ( maybe a button) with fixed size. One inch with all android devices,not dp and not px . That is the needs of my customer. I use "1in" in the layout xml file.However it is not right, I measure it with a ruler. who can give me some help to sovle it?
On the other hand,I want to set it with code.I use densityDpi to caculcate the px first ,Most of the time,it is right,unless I find the dpi and the ppi of some devices are not same.
I have a android tablet.
9 inch
densityDpi=160
1024*600
ppi=132 I use PPI=√(X2+Y2)/ Z (X:width pix;Y:height px;Z: inch of screen)
Then how can i get the ppi by code? I can not get the inch of screen when the application is running . I hopes there is anyother way to get my requirements. Thanks!