如何更改动作导航抽屉?

How to change action Navigation drawer?

我必须实现以下功能。看图

我可以更改导航抽屉的功能吗?我还没有找到解决我的问题的方法。

希望你能帮助我,在此先感谢。

是的,这是可能的。但是我建议你不要这样做,因为它会破坏 UI.

如果您选择这样做,首先您需要能够访问溢出菜单(带圆圈的按钮)。 ,所以我只提供一个 style.xml 片段:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="android:actionOverflowButtonStyle">@style/Overflow</item>
</style>

<style name="Overflow" parent="Widget.AppCompat.ActionBar">
    <item name="android:contentDescription">OVERFLOW</item>
</style>

然后,当单击主页(导航抽屉)按钮时,您会打开溢出菜单:

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == android.R.id.home) {
        final View decor = getWindow().getDecorView();
        ArrayList<View> results = new ArrayList<>();
        decor.findViewsWithText(results, "OVERFLOW",
                View.FIND_VIEWS_WITH_CONTENT_DESCRIPTION);

        if (results.size() == 1) {
            results.get(0).performClick();
            return true;
        }
    }

    return super.onOptionsItemSelected(item);
}