To modify the color of text in Android action bar submenu, you can first create a style in your styles.xml file with a parent of Theme.AppCompat.
<style name="ActionBarSubMenuText" parent="Theme.AppCompat">
<item name="android:textColorSecondary">@color/submenu_text_color</item>
</style>
Then, apply this style to the submenu items in your menu.xml file.
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/menu_item"
android:title="Menu Item"
android:icon="@drawable/ic_menu_item"
app:showAsAction="always">
<menu>
<item
android:id="@+id/submenu_item"
android:title="Submenu Item"
app:actionLayout="@layout/action_layout"
app:showAsAction="always"
app:actionViewClass="android.widget.LinearLayout"
android:theme="@style/ActionBarSubMenuText"/>
</menu>
</item>
</menu>
Note that 'submenutextcolor' is a color resource that you can define in your colors.xml file.
<color name="submenu_text_color">#FFFFFF</color>
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-12-06 11:00:00 +0000
Seen: 15 times
Last updated: Sep 25 '21
How can a ListView be utilized in a ScrollView without a Scrollbar?
How can I detect when someone clicks outside of an Android Compose ModalBottomSheetLayout?
What is the process to activate the screen time off feature in Android using AOSP customization?
What is the proper way to rotate the View Component in React Native for Android?
What is the process of using the Volley library to upload a file on Android?
Is it not possible to set another activity as the main activity in Android Studio?
How can I utilize xml to implement a color filter on an ImageView?