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 2

    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-dimens but simply values - 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