效果图如下:
这个是点击 弹窗中的1。
这个是点击弹窗中的2。
实现代码如下:
1.依赖
implementation 'com.android.support:appcompat-v7:25.3.1'
2.xml控件(布局)
<android.support.v7.widget.Toolbar
android:id="@+id/toobar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
app:popupTheme="@style/ToolbarPopupTheme"
app:titleTextColor="@color/white"
></android.support.v7.widget.Toolbar>
3.activity
ToolBar toobar = findViewById(R.id.toobar