It seems like that for me, on my virtual android device.
If this isn’t the case, then how can I specify eg. 35% of the screen width, without using 360*.35 = 126dp?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No.
It is not “the whole screen width” for any standard Android screen resolution that I can think of. For example, 360dp = 360px for medium density screens and 540px for high-density screens, and I know of precisely zero Android devices with 360px or 540px in either dimension.
Also, bear in mind that “the whole screen width” will vary depending upon whether the device is in portrait or landscape mode.
Use a
LinearLayoutandandroid:layout_weight. Here is a sample project demonstrating this. The key is in the layout:Each widget is denoted as having no intrinsic height, so the total height is divided up among the widgets based on their relative weights.