這裏是我的菜單文件:爲什麼我的菜單始終處於摺疊狀態 - 項目在溢出菜單推
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".PrepareGroups">
<item
android:id="@+id/action_submit"
android:icon="@drawable/ic_action_send_now"
android:orderInCategory="100"
android:title="@string/accept"
app:showAsAction="always" />
</menu>
我的班級簽名:
public class PrepareGroups extends AppCompatActivity
這裏是我的活動的XML佈局:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:custom="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/MyAppbar"
android:layout_width="match_parent"
android:layout_height="256dp"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapse_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_white"
android:fitsSystemWindows="true"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<RelativeLayout
android:layout_width="120dp"
android:layout_height="120dp">
<com.wang.avi.AVLoadingIndicatorView
android:id="@+id/progressBar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:visibility="invisible"
app:indicator="BallScaleMultiple"
app:indicator_color="@color/colorAccent" />
</RelativeLayout>
<com.github.lzyzsd.circleprogress.DonutProgress
android:id="@+id/donut_progress"
android:layout_width="120dp"
android:layout_height="120dp"
android:visibility="invisible"
app:donut_finished_stroke_width="2dp"
app:donut_inner_bottom_text_color="@color/color_white"
app:donut_text_color="@color/color_white"
app:donut_unfinished_stroke_width="5dp"
custom:donut_progress="30" />
</RelativeLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/MyToolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill_vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
</android.support.v7.widget.RecyclerView>
</android.support.design.widget.CoordinatorLayout>
我明確定義:app:showAsAction="always"
但是每次我用三個點得到溢出菜單 - 我不想要。我在這裏錯過什麼?
可以刪除android:orderInCategory =「100」這一行試試。 – Raghavendra
我也嘗試過 - 沒有幫助! – User3
你可以嘗試接受的答案在這個鏈接http://stackoverflow.com/questions/26155963/android-actionbar-always-showing-overflow-menu-for-menu-items-in-actionbar – Raghavendra