zoukankan      html  css  js  c++  java
  • android toolbar

     http://www.jianshu.com/p/79604c3ddcae


    /**
    次主题是为了设置toolbar 右边的三个小点 改变其图标样式用的
    */
    <style name="Theme.ToolBar.ZhiHu" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="actionOverflowButtonStyle">@style/ActionButton.Overflow.ZhiHu</item>
    </style>

    <style name="ActionButton.Overflow.ZhiHu" parent="android:style/Widget.Holo.Light.ActionButton.Overflow">
    <item name="android:src">@mipmap/ic_launcher</item>
    </style>

    在layout中进行引用
    <android.support.v7.widget.Toolbar
    toolbar:popupTheme="@style/MyToolBarTheme"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/Theme.ToolBar.ZhiHu"
    android:background="@android:color/holo_red_dark">

    <!--自定义控件-->
    <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Clock" />
    </android.support.v7.widget.Toolbar>

    其中的theme就是这个作用
      android:theme="@style/Theme.ToolBar.ZhiHu"




    这个是设置了toolbar
    <!--ToolBar 样式-->
    <style name="MyToolBarTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- toolbar颜色 -->
    <item name="colorPrimary">@android:color/holo_red_dark</item>
    <!-- 状态栏的颜色 -->
    <item name="colorPrimaryDark">@android:color/holo_green_dark</item>
    <item name="colorAccent">@android:color/holo_orange_dark</item>

    <!--toolbar 上面的标题的颜色-->
    <item name="android:textColorPrimary">@android:color/holo_orange_light</item>

    <!-- toolbar的主题-->
    <item name="toolbarStyle">@style/ClubToolbar</item>

    <item name="contentInsetStart">0dp</item>
    <item name="contentInsetEnd">0dp</item>


    <!---->


    </style>

    <style name="ClubToolbar" parent="Widget.AppCompat.Toolbar">
    <!-- 设置该属性解决空白部分-->
    <item name="contentInsetStart">16dp</item>
    <item name="contentInsetEnd">16dp</item>
    </style>

    <style name="Theme.ToolBar.ZhiHu" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="actionOverflowButtonStyle">@style/ActionButton.Overflow.ZhiHu</item>
    </style>

    <style name="ActionButton.Overflow.ZhiHu" parent="android:style/Widget.Holo.Light.ActionButton.Overflow">
    <item name="android:src">@mipmap/ic_launcher</item>
    </style>






  • 相关阅读:
    [Todo]很不错的Java面试题类型整理,要看
    [Todo] Java并发编程学习
    自建一个Java Spring MVC项目
    [Todo] 乐观悲观锁,自旋互斥锁等等
    [Todo] Redis里面队列的两种模式,以及抢红包在Redis中的实现
    hdu 4704 同余定理+普通快速幂
    [置顶] ubuntu 和 win7 远程登陆 + vnc登陆
    mysql之触发器
    Jsoup API解析HTML中input标签
    IOS UITableView单条刷新,数据不刷新解决方案
  • 原文地址:https://www.cnblogs.com/jeno-song/p/5882188.html
Copyright © 2011-2022 走看看