菜单3点和应用程序名称不可见,由于白色工具栏?



我想在我的应用程序中使用白色工具栏。但是当我改变颜色时,菜单的三个点是不可见的,因为它的颜色也是白色的。此外,工具栏中的应用程序名称也不可见。如何改变这两个(应用程序名称和菜单点)的颜色。我的xml代码-

<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="@+id/home_toolbar_id"
android:layout_width="match_parent"
app:layout_scrollFlags="scroll|enterAlways|snap"
app:popupTheme="@style/AppTheme.PopupOverlay"
android:layout_height="wrap_content">
</androidx.appcompat.widget.Toolbar>
<com.google.android.material.tabs.TabLayout
android:id="@+id/home_tab_lyt_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways"
style="@style/AppTheme.AppBarOverlay"
android:background="#FFFFFF"
app:tabTextColor="#000">
</com.google.android.material.tabs.TabLayout>

可以通过编程方式改变工具栏文本和菜单颜色的方法

public static void setOverflowColor(final Toolbar toolbar, final int color) {
Drawable drawable = toolbar.getOverflowIcon();
if(drawable != null) {
drawable = DrawableCompat.wrap(drawable);
DrawableCompat.setTint(drawable.mutate(), color);
toolbar.setOverflowIcon(drawable);
toolbar.setTitleTextColor(color)
}
}

您可以将工具栏主题更改为light。这个带有浅色应用程序主题的深色工具栏可以帮助您找到解决问题的方法。

最新更新