您的位置:首页 > 移动开发 > Android开发

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

2017-07-02 00:38 344 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: