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>






  • 相关阅读:
    Drozer渗透测试工具(使用篇)
    Teamcenter中TCComponentItem与TCComponentBOMLine的创建
    Swing中分割面板JSplitPane的使用
    Swing中菜单栏JToolBar的使用
    Javaweb项目导出成jar包并使用Windows定时任务定时执行
    TCSOA获取BOMLine
    SQLite Expert安装与注册
    获取分类节点
    处理TC的Command问题
    通过TCComponentBomLine获取ItemRevision的两种情况
  • 原文地址:https://www.cnblogs.com/jeno-song/p/5882188.html
Copyright © 2011-2022 走看看