Kristiyan Gergov
Kristiyan Gergov

Reputation: 161

How to change menu drawer-view items text size from "sp" to "dp"

So as I researched the only way to prevent your android app to accept system current set fonts is to use "dp" instead of "sp" as explained here. So it did worked but not really. Since menu layout for drawer-view is a little different from normal layouts and there is not even attribute textSize i do not really know how to do that. Here is the code

Drawer-view

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <group
        android:id="@+id/activities"
        android:checkableBehavior="single">
        <item
            android:id="@+id/start"
            android:icon="@drawable/ic_date_range_blue_24dp"
            android:title="@string/Start" />
        <item
            android:id="@+id/newReview"
            android:icon="@drawable/ic_add_circle_blue_24dp"
            android:title="@string/newReview" />
        <item
            android:id="@+id/myReviews"
            android:icon="@drawable/ic_date_range_blue_24dp"
            android:title="@string/myReviews" />
        <item
            android:id="@+id/profile"
            android:icon="@drawable/ic_account_circle_blue_24dp"
            android:title="@string/profile" />
        <item
            android:id="@+id/messages"
            android:icon="@drawable/ic_message_blue_24dp"
            android:title="@string/messages" />
        <item
            android:id="@+id/feedback"
            android:icon="@drawable/ic_star_half_green_24dp"
            android:title="@string/feedback" />
    </group>
    <group android:id="@+id/exit_group">
        <item
            android:id="@+id/exit"
            android:icon="@drawable/ic_exit_to_app_blue_24dp"
            android:title="Изход">

        </item>
    </group>
    <group android:id="@+id/application">
        <item
            android:id="@+id/about"
            android:title="@string/about" />
        <item
            android:id="@+id/terms"
            android:title="@string/terms" />
    </group>
    <group android:id="@+id/rights">
        <item
            android:id="@+id/right"
            android:title="@string/rights" />
    </group>
</menu>

As you can see drawer-view font-size is much bigger than the normal-layout

Upvotes: 1

Views: 75

Answers (1)

Vishal Sharma
Vishal Sharma

Reputation: 1061

this code inside the styles.xml

  <style name="menu_text_style" parent="@android:style/TextAppearance.DeviceDefault.Widget.ActionBar.Menu">
        <item name="android:textSize">16dp</item>
        <item name="android:textColor">#0D2142</item>
        <item name="android:textAllCaps">false</item>

    </style>

and add on navigationView app:itemTextAppearance="@style/menu_text_style"

Upvotes: 1

Related Questions