[英]How to delete collapsing toolbar in android
Right now I have collapsing toolbar from material design. 现在,我从材料设计中折叠了工具栏。
I want to change it to default or material action bar. 我想将其更改为默认或实质操作栏。
Can i do it from menu.xml or any alternative way? 我可以从menu.xml或任何其他方式来做到吗?
My code is bellow. 我的代码在下面。 If you need more code, ask me.
如果您需要更多代码,请问我。
Thanks a lot. 非常感谢。
<android.support.design.widget.CoordinatorLayout
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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.mateoj.popularmoviesdemo.MovieDetailActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:fitsSystemWindows="true"
android:layout_height="@dimen/app_bar_height"
android:layout_width="match_parent"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:contentScrim="?attr/colorPrimary">
<ImageView
android:id="@+id/backdrop"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
app:layout_collapseMode="pin"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_movie_detail"/>
</android.support.design.widget.CoordinatorLayout>
Menu.xml code is bellow: Menu.xml代码如下:
**menu.xml**
<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="com.demo.mtin.mtin.MovieDetailActivity">
<item android:id="@+id/action_settings"
android:title="@string/action_settings"
android:orderInCategory="100"
app:showAsAction="never"/>
</menu>
Of course. 当然。 Remove CollapsingToolbarLayout and set your desing to toolbar after that use setActionBar(yourtoolbar) method.
删除CollapsingToolbarLayout,然后使用setActionBar(yourtoolbar)方法将您的设计设置为工具栏。 More information read this: https://guides.codepath.com/android/Using-the-App-ToolBar
有关更多信息,请阅读: https : //guides.codepath.com/android/Using-the-App-ToolBar
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.