First, I am using Jetpack Navigation Component - navigation drawer.
And "No Action Bar" is my app's main style.
<style name="NoActionBar" parent="AppTheme">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="preferenceTheme">@style/PrefsTheme</item>
</style>
Here is the manifest.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxx.xxx">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:name=".MainApplication"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".ui.MainActivity"
android:screenOrientation="portrait"
android:theme="@style/NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Because I use Jetpack Navigation Component, it is a single activity pattern.
In general, my UIs have a custom toolbar. It's ok.
But in case of the Settings UI, I faced a problem...
I am using Jetpack Preferences. https://developer.android.com/guide/topics/ui/settigs
My settings UI extends "PreferenceFragmentCompat" and it is defined in "nav_graph.xml", too.
So it can be accessed by below code:
findNavController().navigate(R.id.settingsFragment)
Because my app uses "NoActionBar", the preference has no action bar too. And the preference is made by Jetpack Preferences, I cannot add a custom toolbar.
Is there any good idea/solution, please?