2

I am using Toolbar on which i set title text.but for different screen i have define different title text size using style. but the problem is when i run this on phone which screen is mdpi the title text size is OK but for the screen of tablet mdpi the Title is looking too small this is my style

<style name="Toolbar.TitleText" parent="TextAppearance.Widget.AppCompat.Toolbar.Title">
        <item name="android:textSize">15dp</item>
        <item name="android:textStyle">bold</item>
    </style>

this is toolbar.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar"
    android:minHeight="?attr/actionBarSize"
    android:background="@color/colorPrimary"
    android:layout_width="match_parent"
    android:layout_height="50dp"

    app:titleTextAppearance="@style/Toolbar.TitleText"
    android:subtitleTextAppearance="@style/AppTheme.Toolbar.SubTitle"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
    app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>

i have declared this style in all folder like style.xml(mdpi),style.xml(hdpi),style.xml(xhdpi) with diffrenttext size. so please help me how to set text size of title so it look good on both phone and tablet

Ghanshyam Sharma
  • 451
  • 9
  • 21

1 Answers1

5

in all dimens.xml

<dimen name="myTextSize">xxxxxsp</dimen>

in values/style.xml

<style name="Toolbar.TitleText" parent="TextAppearance.Widget.AppCompat.Toolbar.Title">
    <item name="android:textSize">@dimen/myTextSize</item>
</style>
lomg
  • 136
  • 2