Можно ли удалить жирный стиль из пункта меню в NavigationView? - PullRequest
0 голосов
/ 07 сентября 2018

enter image description here

<menu>
    ...
    <group
        android:id="@+id/nav_group_footer"
        android:checkableBehavior="none">
        <item
            android:id="@+id/nav_item_last_updated"
            android:title="Last updated: 2018-09-07 21:47" />
    </group>
</menu>

Я могу справиться с этим в коде, подобном этому mLastUpdatedView = mNavigationView.getMenu().findItem(R.id.nav_item_last_updated);, но тогда я не уверен, как отредактировать его стиль. Я искал вокруг и видел некоторые возможные решения, которые включают изменение styles.xml, но я думаю, что если я изменю вещи там, другие пункты меню также будут изменены. Я только хочу удалить жирный текстовый стиль из нижнего колонтитула. Есть ли способ сделать это программно?

1 Ответ

0 голосов
/ 07 сентября 2018
follow this way for achieving that:  
  <?xml version="1.0" encoding="utf-8"?>
    <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/drawer_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        tools:openDrawer="start">

        <include
            layout="@layout/app_bar_main2"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

        <android.support.design.widget.NavigationView
            android:id="@+id/nav_view"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            android:fitsSystemWindows="true"
            app:headerLayout="@layout/nav_header_main2"
            app:menu="@menu/activity_main2_drawer" >


            <TextView

                android:layout_gravity="bottom"
                android:text="Last updated: 2018-09-07 21:47"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

        </android.support.design.widget.NavigationView>



    </android.support.v4.widget.DrawerLayout>.
...