简体   繁体   中英

Android screen scaling problems

I have been making an app which has a TextView on the screen which should touch the borders of the screen on the left and right sides.

But since android has its weird unit "dp", which changed with larger or smaller devices, it is a huge problem making the above thing work perfectly on every device.

I have created ldpi, mdpi, hdpi, xhdpi & xxhdpi values for the text size. Still the size is not consistent on all phones.

Moreover, the size is different on 720p screens of different phones. Some touch the border, on some it reflows to the next line which is disgusting coz its a large size text, and on some it is far from the edges.

Is there an unit where I can put the value as a percentage of the screen? Or atleast an unit which has a constant maximum value for the the width and height?

Please help

I hope I undertood well, do you want to put a textview that it has all widh of the screen? In this case you should use the property android:width and put as a Fill parent for example; you don't use wrap content asa property this property adjust the textview size to the content. You can do it with chart of properties on the editor or with a sentence on xml file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM