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>






  • 相关阅读:
    青蛙的约会
    租用游艇问题
    宾馆房间
    [USACO10FEB]购买巧克力Chocolate Buying
    骑士的工作
    Power Strings
    [HAOI2006]聪明的猴子
    骑马修栅栏 Riding the Fences
    [USACO06JAN]牛的舞会The Cow Prom
    UVA 11294 wedding 2-sat
  • 原文地址:https://www.cnblogs.com/jeno-song/p/5882188.html
Copyright © 2011-2022 走看看