android toolbar 显示返回按钮并改变按钮颜色

来源:互联网 发布:跳转 打开淘宝客户端 编辑:程序博客网 时间:2024/05/16 13:04

layout 布局文件中

<android.support.design.widget.AppBarLayout    android:id="@+id/about_appbar"    android:layout_width="match_parent"    android:layout_height="wrap_content"    android:theme="@style/toolbar_theme">  <com.crazier.handprogramlession.view.SuperToolbar      android:id="@+id/article_content_toolbar"      android:layout_width="match_parent"      android:layout_height="?attr/actionBarSize"      android:background="?attr/colorPrimary"/></android.support.design.widget.AppBarLayout>

styles.xml 文件中

<style name="toolbar_theme" parent="@style/ThemeOverlay.AppCompat.Dark.ActionBar">  <item name="colorControlNormal">@color/color_white</item></style>

xxxActivity文件中
显示返回按钮:

setSupportActionBar(toolbar);getSupportActionBar().setDisplayHomeAsUpEnabled(true);

来源
http://www.cnblogs.com/agilezhu/p/6698680.html

原创粉丝点击