There are two markup layout-sw200dp and layout-sw600dp. How to change the font of the text of the screen title, depending on the width of the screen. In layout-sw200dp, the text does not fit the screen, dots appear instead of letters. You can reduce the number of words in the title, but I would like to understand.
2 answers
Use different font sizes sp for different screens. Create two more values ββfor values ββfor sw200 and sw600 in addition to the main
- Not in
values-dimensbut simplyvalues- Flippy - Oh, sorry, did not notice - DevOma
|
Here's a note for you
values-sw720dp 10.1β tablet 1280x800 mdpi values-sw600dp 7.0β tablet 1024x600 mdpi values-sw480dp 5.4β 480x854 mdpi values-sw480dp 5.1β 480x800 mdpi values-xhdpi 4.7β 1280x720 xhdpi values-xhdpi 4.65β 720x1280 xhdpi values-hdpi 4.0β 480x800 hdpi values-hdpi 3.7β 480x854 hdpi values-mdpi 3.2β 320x480 mdpi values-ldpi 3.4β 240x432 ldpi values-ldpi 3.3β 240x400 ldpi values-ldpi 2.7β 240x320 ldpi About different sizes on different screens
1) Create folders with names in the table above (on the left) and create in each file a file dimen.xml . Write in them a different size, expressed in sp , since the text is best represented in it. Like that
<resources> <dimen name="toolbar_title">20sp</dimen> </resources> In each folder. Only the size of 20sp .
2) Make the Toolbar use title style
app:titleTextAppearance="@style/ToolbarTitle" 3) And style in styles.xml
<style name="ToolbarTitle" parent="@style/TextAppearance.Widget.AppCompat.Toolbar.Title"> <item name="android:textSize">@dimen/toolbar_title</item> </style> You should have the values folder, everything remains as well, do not mess up
|