• 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>






  • 相关阅读:
    解决The markup in the document following the root element must be well-formed.
    全排列算法:递归和非递归实现
    利用异或运算实现交换2个数据
    dojo 代码调试
    dogo 官方翻译 Ajax with dojo/request
    dojo 官方翻译 dojo/Deferred
    dojo 官方翻译 dojo/aspect
    get app id
    [转]解决eclipse无法设置NDK问题
    关于二级指针
  • 原文地址:https://www.cnblogs.com/jeno-song/p/5882188.html
Copyright © 2020-2023  润新知