我看不到如何增加从标题的弹出式菜单来完成像显示在众多的材料设计实例。任何帮助将是非常美联社preciated。
I'm unable to see how adding a popup menu from the title is accomplished like is shown in many of the material design examples. Any help would be much appreciated.
你会需要一个微调添加到工具栏:
You're going to need to add a Spinner to the Toolbar:
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
android:background="?attr/colorPrimary">
<Spinner
android:id="@+id/spinner_nav"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</android.support.v7.widget.Toolbar>
您一定要去禁用默认的标题:
You will then need to disable the default title:
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowTitleEnabled(false);
然后,您可以根据需要在你的活动获取和设置微调/片段。
You can then retrieve and setup the Spinner as needed in your Activity/Fragment.