android:ToolBar詳解

youyinet 8年前發布 | 8K 次閱讀 Android開發 移動開發

來源 http://blog.mosil.biz/2014/10/android-toolbar/

這篇文章因為是臺灣人寫的,語言風格很別致。本文在原文的基礎上做了一些微調(主要是繁體字的問題)。

今年(2014) 的 google i/o 發表令多數人為之一亮的 material design,而 google 也從「google i/o 2014」 開始,大家也陸陸續續地看到其更新的 android app 皆套用了這個設計介面。當然,這個設計介面著實讓大家感到驚艷外,更讓 android 開發者開始擔心未來 app 的界面處理了。

不過,所幸有著之前 actionbar 的經驗后,android 也很快地在 support library 里面提供了相對應的 api 給開發者使用,本篇就為各位介紹 – toolbar,這是用來取代過去 actionbar 的控件,而現在于 material design 中也對之有一個統一名稱:app bar,在未來的 android app 中,就以 toolbar 這個元件來實作之。

1. 概述

Android 3.0  Android 推了 ActionBar 這個控件,而到了2013 年 Google 開始大力地推動所謂的 android style,想要逐漸改善過去 android 紛亂的界面設計,希望讓終端使用者盡可能在 android 手機有個一致的操作體驗。ActionBar 過去最多人使用的兩大套件就是 ActionBarSherlock 以及官方提供在 support library v 7 里的 AppCompat。

既然會有本篇跟各位介紹的 Toolbar,也意味著官方在某些程度上認為 ActionBar 限制了 android app 的開發與設計的彈性,而在 material design 也對之做了名稱的定義:App bar。接下來將為各位分成幾個階段進行說明,如何在 android app 中用 toolbar 這個控件來做出一個基本的 app bar 嘍。

本篇所使用到的程序請到 Github 取得。

2. 基礎套用

這個階段從 toolbar_demo_checkpoint0 開始,分成下列三個部份:

風格 (style)
界面 (layout)
程序 (java)

2.1 風格(style)

風格要調整的地方有二

一在 res/values/styles.xml中

二在 /res/values-v21/styles.xml中

為了之后設定方便,我們先在 res/values/styles.xml 里增加一個名為 AppTheme.Base 的風格

  • 1
        <div class="line number2 index1 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          2
        </div>
    
        <div class="line number3 index2 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          3
        </div>
    
        <div class="line number4 index3 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          4
        </div>
    

    </td>

       <td class="code" style="width:822px;padding:0px!important;border:0px!important;margin:0px!important;font-size:1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important;min-height:inherit!important;background:none!important;"> 
        <div class="container" style="border:0px!important;margin:0px!important;padding:0px!important;width:auto!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:relative!important;right:auto!important;top:auto!important;vertical-align:baseline!important;font-size:1em!important;min-height:inherit!important;background:none!important;"> 
         <div class="line number1 index0 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><style name=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"AppTheme.Base"</code> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">parent=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"Theme.AppCompat"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">></code>          </div>
    
         <div class="line number2 index1 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><item name=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"windowActionBar"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">></code>           <code class="js keyword" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:#006699!important;">false</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"></item></code>          </div>
    
         <div class="line number3 index2 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><item name=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"android:windowNoTitle"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">></code>           <code class="js keyword" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:#006699!important;">true</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"></item></code>          </div>
    
         <div class="line number4 index3 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"></style></code>          </div>
    
        </div>
    

    </td>

      </tr>
    
     </tbody>
    
    </table>
    
    

    </div>

    </div>

    因為此范例只使用 Toolbar,所以我們要將讓原本的 ActionBar 隱藏起來,然后將原本 AppTheme 的 parent 屬性 改為上面的AppTheme.Base,代碼如下:

  • 1
        <div class="line number2 index1 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          2
        </div>
    
        <div class="line number3 index2 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          3
        </div>
    
        <div class="line number4 index3 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          4
        </div>
    
        <div class="line number5 index4 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          5
        </div>
    
        <div class="line number6 index5 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          6
        </div>
    
        <div class="line number7 index6 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          7
        </div>
    
        <div class="line number8 index7 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          8
        </div>
    
        <div class="line number9 index8 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          9
        </div>
    
        <div class="line number10 index9 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          10
        </div>
    
        <div class="line number11 index10 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          11
        </div>
    
        <div class="line number12 index11 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          12
        </div>
    

    </td>

       <td class="code" style="width:12321px;padding:0px!important;border:0px!important;margin:0px!important;font-size:1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important;min-height:inherit!important;background:none!important;"> 
        <div class="container" style="border:0px!important;margin:0px!important;padding:0px!important;width:auto!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:relative!important;right:auto!important;top:auto!important;vertical-align:baseline!important;font-size:1em!important;min-height:inherit!important;background:none!important;"> 
         <div class="line number1 index0 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><resources></code>          </div>
    
         <div class="line number2 index1 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           </code> 
         </div>
    
         <div class="line number3 index2 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><!-- Base application theme. --></code>          </div>
    
         <div class="line number4 index3 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><style name=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"AppTheme"</code> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">parent=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"AppTheme.Base"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">></code>          </div>
    
         <div class="line number5 index4 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"></style></code>          </div>
    
         <div class="line number6 index5 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </code> 
         </div>
    
         <div class="line number7 index6 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><style name=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"AppTheme.Base"</code> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">parent=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"Theme.AppCompat"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">></code>          </div>
    
         <div class="line number8 index7 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">    </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><item name=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"windowActionBar"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">></code>           <code class="js keyword" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:#006699!important;">false</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"></item></code>          </div>
    
         <div class="line number9 index8 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">    </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><item name=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"android:windowNoTitle"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">></code>           <code class="js keyword" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:#006699!important;">true</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"></item></code>          </div>
    
         <div class="line number10 index9 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"></style></code>          </div>
    
         <div class="line number11 index10 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           </code> 
         </div>
    
         <div class="line number12 index11 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"></resources></code>          </div>
    
        </div>
    

    </td>

      </tr>
    
     </tbody>
    
    </table>
    
    

    </div>

    </div>

    再來調整Android 5.0的style:  /res/values-v21/styles.xml,也將其 parent 屬性改為  AppTheme.Base:

  • 1
        <div class="line number2 index1 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          2
        </div>
    
        <div class="line number3 index2 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          3
        </div>
    
        <div class="line number4 index3 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          4
        </div>
    
        <div class="line number5 index4 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          5
        </div>
    

    </td>

       <td class="code" style="width:822px;padding:0px!important;border:0px!important;margin:0px!important;font-size:1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important;min-height:inherit!important;background:none!important;"> 
        <div class="container" style="border:0px!important;margin:0px!important;padding:0px!important;width:auto!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:relative!important;right:auto!important;top:auto!important;vertical-align:baseline!important;font-size:1em!important;min-height:inherit!important;background:none!important;"> 
         <div class="line number1 index0 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><?xml version=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"1.0"</code> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">encoding=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"utf-8"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">?></code>          </div>
    
         <div class="line number2 index1 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><resources></code>          </div>
    
         <div class="line number3 index2 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">    </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><style name=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"AppTheme"</code> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">parent=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"AppTheme.Base"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">></code>          </div>
    
         <div class="line number4 index3 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">    </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"></style></code>          </div>
    
         <div class="line number5 index4 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"></resources></code>          </div>
    
        </div>
    

    </td>

      </tr>
    
     </tbody>
    
    </table>
    
    

    </div>

    </div>

    1
    <br>
        </div>
    

    </td>

      </tr>
    
     </tbody>
    
    </table>
    
    

    </div>

    </div>

    2.2  界面(Layout)

    在 activity_main.xml 里面添加 Toolbar 控件:

  • 1
        <div class="line number2 index1 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          2
        </div>
    
        <div class="line number3 index2 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          3
        </div>
    
        <div class="line number4 index3 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          4
        </div>
    
        <div class="line number5 index4 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          5
        </div>
    
        <div class="line number6 index5 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          6
        </div>
    
        <div class="line number7 index6 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          7
        </div>
    

    </td>

       <td class="code" style="width:11636px;padding:0px!important;border:0px!important;margin:0px!important;font-size:1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important;min-height:inherit!important;background:none!important;"> 
        <div class="container" style="border:0px!important;margin:0px!important;padding:0px!important;width:auto!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:relative!important;right:auto!important;top:auto!important;vertical-align:baseline!important;font-size:1em!important;min-height:inherit!important;background:none!important;"> 
         <div class="line number1 index0 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><android.support.v7.widget.Toolbar</code>          </div>
    
         <div class="line number2 index1 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">android:id=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"@+id/toolbar"</code>          </div>
    
         <div class="line number3 index2 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">android:layout_height=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"wrap_content"</code>          </div>
    
         <div class="line number4 index3 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">android:layout_width=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"match_parent"</code>          </div>
    
         <div class="line number5 index4 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">android:minHeight=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"?attr/actionBarSize"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">></code>          </div>
    
         <div class="line number6 index5 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   </code> 
         </div>
    
         <div class="line number7 index6 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"></android.support.v7.widget.Toolbar></code>          </div>
    
        </div>
    

    </td>

      </tr>
    
     </tbody>
    
    </table>
    
    

    </div>

    </div>

    請記得用 support v7 里的 toolbar,不然然只有 API Level 21 也就是 Android 5.0 以上的版本才能使用。

    這里需注意,要將 RelatvieLayout 里的四個方向的padding 屬性去掉,并記得將原本的 Hello World 設為 layout_below="@+id/toolbar" ,否則會看到像下面這樣的錯誤畫面。

    2.3 程序 (Java)

    在 MainActivity.java 中加入 Toolbar 的聲明:

  • 1
        <div class="line number2 index1 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          2
        </div>
    

    </td>

       <td class="code" style="width:822px;padding:0px!important;border:0px!important;margin:0px!important;font-size:1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important;min-height:inherit!important;background:none!important;"> 
        <div class="container" style="border:0px!important;margin:0px!important;padding:0px!important;width:auto!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:relative!important;right:auto!important;top:auto!important;vertical-align:baseline!important;font-size:1em!important;min-height:inherit!important;background:none!important;"> 
         <div class="line number1 index0 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);</code>          </div>
    
         <div class="line number2 index1 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">setSupportActionBar(toolbar);</code>          </div>
    
        </div>
    

    </td>

      </tr>
    
     </tbody>
    
    </table>
    
    

    </div>

    </div>

    聲明后,再將之用 setSupportActionBar 設定,Toolbar即能取代原本的 actionbar 了,此階段完成畫面如下:

    完整代碼見:toolbar_demo_checkpoint1


    3. 自定義顏色(Customization color)

    這個階段將從 toolbar_demo_checkpoint1 接著往下進行:


    上圖是將本階段要完成的結果畫面做了標示,結合下面的描述希望大家能明白。

    1. colorPrimaryDark(狀態欄底色):在風格 (styles) 或是主題 (themes) 里進行設定。

    2. App bar 底色

      這個設定分為二,若你的 android app 仍是使用 actionbar ,則直接在風格 (styles) 或是主題 (themes) 里進行設定 colorPrimary 參數即可;
      可若是采用 toolbar 的話,則要在界面 (layout) 里面設定 toolbar 控件的 background 屬性。

    3. navigationBarColor(導航欄底色):

    僅能在 API v21 也就是 Android 5 以后的版本中使用, 因此要將之設定在 res/values-v21/styles.xml 里面。

    1. 主視窗底色:windowBackground

    也因此在這個階段,我們需要設定的地方有三,一是 style中(res/values/styles.xml)

    1
        <div class="line number2 index1 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          2
        </div>
    
        <div class="line number3 index2 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          3
        </div>
    
        <div class="line number4 index3 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          4
        </div>
    
        <div class="line number5 index4 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          5
        </div>
    
        <div class="line number6 index5 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          6
        </div>
    
        <div class="line number7 index6 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          7
        </div>
    
        <div class="line number8 index7 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          8
        </div>
    
        <div class="line number9 index8 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          9
        </div>
    
        <div class="line number10 index9 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          10
        </div>
    

    </td>

       <td class="code" style="width:814px;padding:0px!important;border:0px!important;margin:0px!important;font-size:1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important;min-height:inherit!important;background:none!important;"> 
        <div class="container" style="border:0px!important;margin:0px!important;padding:0px!important;width:auto!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:relative!important;right:auto!important;top:auto!important;vertical-align:baseline!important;font-size:1em!important;min-height:inherit!important;background:none!important;"> 
         <div class="line number1 index0 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><style name=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"AppTheme.Base"</code> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">parent=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"Theme.AppCompat"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">></code>          </div>
    
         <div class="line number2 index1 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><item name=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"windowActionBar"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">></code>           <code class="js keyword" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:#006699!important;">false</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"></item></code>          </div>
    
         <div class="line number3 index2 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><item name=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"android:windowNoTitle"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">></code>           <code class="js keyword" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:#006699!important;">true</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"></item></code>          </div>
    
         <div class="line number4 index3 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><!-- Actionbar color --></code>          </div>
    
         <div class="line number5 index4 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><item name=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"colorPrimary"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">>@color/accent_material_dark</item></code>          </div>
    
         <div class="line number6 index5 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><!--Status bar color--></code>          </div>
    
         <div class="line number7 index6 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><item name=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"colorPrimaryDark"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">>@color/accent_material_light</item></code>          </div>
    
         <div class="line number8 index7 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><!--Window color--></code>          </div>
    
         <div class="line number9 index8 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><item name=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"android:windowBackground"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">>@color/dim_foreground_material_dark</item></code>          </div>
    
         <div class="line number10 index9 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"></style></code>          </div>
    
        </div>
    

    </td>

      </tr>
    
     </tbody>
    
    </table>
    
    

    </div>

    </div>

    再來是 v21 的style中 (res/values-v21/styles.xml)

    1
        <div class="line number2 index1 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          2
        </div>
    
        <div class="line number3 index2 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          3
        </div>
    
        <div class="line number4 index3 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          4
        </div>
    

    </td>

       <td class="code" style="width:822px;padding:0px!important;border:0px!important;margin:0px!important;font-size:1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important;min-height:inherit!important;background:none!important;"> 
        <div class="container" style="border:0px!important;margin:0px!important;padding:0px!important;width:auto!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:relative!important;right:auto!important;top:auto!important;vertical-align:baseline!important;font-size:1em!important;min-height:inherit!important;background:none!important;"> 
         <div class="line number1 index0 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><style name=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"AppTheme"</code> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">parent=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"AppTheme.Base"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">></code>          </div>
    
         <div class="line number2 index1 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><!--Navigation bar color--></code>          </div>
    
         <div class="line number3 index2 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><item name=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"android:navigationBarColor"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">>@color/accent_material_light</item></code>          </div>
    
         <div class="line number4 index3 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"></style></code>          </div>
    
        </div>
    

    </td>

      </tr>
    
     </tbody>
    
    </table>
    
    

    </div>

    </div>

    最后,就是為了本篇的主角 – Toolbar 的 background 進行設定。

    1
        <div class="line number2 index1 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          2
        </div>
    
        <div class="line number3 index2 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          3
        </div>
    
        <div class="line number4 index3 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          4
        </div>
    
        <div class="line number5 index4 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          5
        </div>
    
        <div class="line number6 index5 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          6
        </div>
    
        <div class="line number7 index6 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          7
        </div>
    
        <div class="line number8 index7 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          8
        </div>
    

    </td>

       <td class="code" style="width:7202px;padding:0px!important;border:0px!important;margin:0px!important;font-size:1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important;min-height:inherit!important;background:none!important;"> 
        <div class="container" style="border:0px!important;margin:0px!important;padding:0px!important;width:auto!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:relative!important;right:auto!important;top:auto!important;vertical-align:baseline!important;font-size:1em!important;min-height:inherit!important;background:none!important;"> 
         <div class="line number1 index0 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><android.support.v7.widget.Toolbar</code>          </div>
    
         <div class="line number2 index1 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">android:id=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"@+id/toolbar"</code>          </div>
    
         <div class="line number3 index2 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">android:layout_height=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"wrap_content"</code>          </div>
    
         <div class="line number4 index3 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">android:layout_width=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"match_parent"</code>          </div>
    
         <div class="line number5 index4 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">android:background=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"?attr/colorPrimary"</code>          </div>
    
         <div class="line number6 index5 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">android:minHeight=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"?attr/actionBarSize"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">></code>          </div>
    
         <div class="line number7 index6 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   </code> 
         </div>
    
         <div class="line number8 index7 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"></android.support.v7.widget.Toolbar></code>          </div>
    
        </div>
    

    </td>

      </tr>
    
     </tbody>
    
    </table>
    
    

    </div>

    </div>


    在本范例中,toolbar 是設定來在 activity_main.xml,對其設定 background 屬性: android:background="?attr/colorPrimary" ,這樣就可以使之延用 Actionbar 的顏色設定嘍。

    最后,再來看一下結果畫面。

    完整代碼見: toolbar_demo_checkpoint2

    4. 控件 (component)

    本階段將從 toolbar_demo_checkpoint2 接續,在還未于 <android.support.v7.widget.Toolbar/>  標簽中,自行添加元件的 toolbar 有幾個大家常用的元素可以使用,請先見下圖:


    大抵來說,預設常用的幾個元素就如圖中所示,接著就依序來說明之:

    1. setNavigationIcon
      即設定 up button 的圖標,因為 Material 的介面,在 Toolbar這里的 up button樣式也就有別于過去的 ActionBar 哦。

    1. setLogo
      APP 的圖標。

    2. setTitle
      主標題。

    3. setSubtitle
      副標題。

    4. setOnMenuItemClickListener
      設定菜單各按鈕的動作。

    先來看到菜單外的代碼,在 MainActivity.java 中:

    先來看到

  • 1
        <div class="line number2 index1 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          2
        </div>
    
        <div class="line number3 index2 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          3
        </div>
    
        <div class="line number4 index3 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          4
        </div>
    
        <div class="line number5 index4 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          5
        </div>
    
        <div class="line number6 index5 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          6
        </div>
    
        <div class="line number7 index6 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          7
        </div>
    
        <div class="line number8 index7 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          8
        </div>
    
        <div class="line number9 index8 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          9
        </div>
    
        <div class="line number10 index9 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          10
        </div>
    
        <div class="line number11 index10 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          11
        </div>
    
        <div class="line number12 index11 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          12
        </div>
    
        <div class="line number13 index12 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          13
        </div>
    
        <div class="line number14 index13 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          14
        </div>
    

    </td>

       <td class="code" style="width:6317px;padding:0px!important;border:0px!important;margin:0px!important;font-size:1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important;min-height:inherit!important;background:none!important;"> 
        <div class="container" style="border:0px!important;margin:0px!important;padding:0px!important;width:auto!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:relative!important;right:auto!important;top:auto!important;vertical-align:baseline!important;font-size:1em!important;min-height:inherit!important;background:none!important;"> 
         <div class="line number1 index0 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);</code>          </div>
    
         <div class="line number2 index1 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                </code> 
         </div>
    
         <div class="line number3 index2 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js comments" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:#008200!important;">// App Logo</code>          </div>
    
         <div class="line number4 index3 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">toolbar.setLogo(R.drawable.ic_launcher);</code>          </div>
    
         <div class="line number5 index4 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js comments" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:#008200!important;">// Title</code>          </div>
    
         <div class="line number6 index5 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">toolbar.setTitle(</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"My Title"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">);</code>          </div>
    
         <div class="line number7 index6 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js comments" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:#008200!important;">// Sub Title</code>          </div>
    
         <div class="line number8 index7 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">toolbar.setSubtitle(</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"Sub title"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">);</code>          </div>
    
         <div class="line number9 index8 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                </code> 
         </div>
    
         <div class="line number10 index9 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">setSupportActionBar(toolbar);</code>          </div>
    
         <div class="line number11 index10 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                </code> 
         </div>
    
         <div class="line number12 index11 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js comments" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:#008200!important;">// Navigation Icon 要設定在 setSupoortActionBar 才有作用</code>          </div>
    
         <div class="line number13 index12 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js comments" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:#008200!important;">// 否則會出現 back button</code>          </div>
    
         <div class="line number14 index13 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">toolbar.setNavigationIcon(R.drawable.ab_android);</code>          </div>
    
        </div>
    

    </td>

      </tr>
    
     </tbody>
    
    </table>
    
    

    </div>

    </div>

    這邊要留意的是setNavigationIcon需要放在 setSupportActionBar之后才會生效。

    菜單部分,需要先在res/menu/menu_main.xml左定義:

    1
        <div class="line number2 index1 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          2
        </div>
    
        <div class="line number3 index2 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          3
        </div>
    
        <div class="line number4 index3 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          4
        </div>
    
        <div class="line number5 index4 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          5
        </div>
    
        <div class="line number6 index5 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          6
        </div>
    
        <div class="line number7 index6 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          7
        </div>
    
        <div class="line number8 index7 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          8
        </div>
    
        <div class="line number9 index8 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          9
        </div>
    
        <div class="line number10 index9 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          10
        </div>
    
        <div class="line number11 index10 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          11
        </div>
    
        <div class="line number12 index11 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          12
        </div>
    
        <div class="line number13 index12 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          13
        </div>
    
        <div class="line number14 index13 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          14
        </div>
    
        <div class="line number15 index14 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          15
        </div>
    
        <div class="line number16 index15 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          16
        </div>
    
        <div class="line number17 index16 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          17
        </div>
    
        <div class="line number18 index17 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          18
        </div>
    
        <div class="line number19 index18 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          19
        </div>
    
        <div class="line number20 index19 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          20
        </div>
    
        <div class="line number21 index20 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          21
        </div>
    
        <div class="line number22 index21 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          22
        </div>
    

    </td>

       <td class="code" style="width:6256px;padding:0px!important;border:0px!important;margin:0px!important;font-size:1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important;min-height:inherit!important;background:none!important;"> 
        <div class="container" style="border:0px!important;margin:0px!important;padding:0px!important;width:auto!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:relative!important;right:auto!important;top:auto!important;vertical-align:baseline!important;font-size:1em!important;min-height:inherit!important;background:none!important;"> 
         <div class="line number1 index0 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><menu xmlns:android=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"<a target="_blank" href="/misc/goto?guid=4959517936744177530">http://schemas.android.com/apk/res/android</a>"</code>          </div>
    
         <div class="line number2 index1 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">      </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">xmlns:app=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"<a target="_blank" href="/misc/goto?guid=4958334120232676061">http://schemas.android.com/apk/res-auto</a>"</code>          </div>
    
         <div class="line number3 index2 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">      </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">xmlns:tools=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"<a target="_blank" href="/misc/goto?guid=4959542256708092975">http://schemas.android.com/tools</a>"</code>          </div>
    
         <div class="line number4 index3 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">      </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">tools:context=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">".MainActivity"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">></code>          </div>
    
         <div class="line number5 index4 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        </code> 
         </div>
    
         <div class="line number6 index5 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><item android:id=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"@+id/action_edit"</code>          </div>
    
         <div class="line number7 index6 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">        </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">android:title=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"@string/action_edit"</code>          </div>
    
         <div class="line number8 index7 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">        </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">android:orderInCategory=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"80"</code>          </div>
    
         <div class="line number9 index8 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">        </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">android:icon=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"@drawable/ab_edit"</code>          </div>
    
         <div class="line number10 index9 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">        </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">app:showAsAction=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"ifRoom"</code> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">/></code>          </div>
    
         <div class="line number11 index10 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        </code> 
         </div>
    
         <div class="line number12 index11 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><item android:id=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"@+id/action_share"</code>          </div>
    
         <div class="line number13 index12 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">        </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">android:title=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"@string/action_edit"</code>          </div>
    
         <div class="line number14 index13 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">        </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">android:orderInCategory=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"90"</code>          </div>
    
         <div class="line number15 index14 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">        </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">android:icon=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"@drawable/ab_share"</code>          </div>
    
         <div class="line number16 index15 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">        </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">app:showAsAction=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"ifRoom"</code> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">/></code>          </div>
    
         <div class="line number17 index16 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        </code> 
         </div>
    
         <div class="line number18 index17 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"><item android:id=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"@+id/action_settings"</code>          </div>
    
         <div class="line number19 index18 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">        </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">android:title=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"@string/action_settings"</code>          </div>
    
         <div class="line number20 index19 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">        </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">android:orderInCategory=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"100"</code>          </div>
    
         <div class="line number21 index20 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">        </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">app:showAsAction=</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"never"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">/></code>          </div>
    
         <div class="line number22 index21 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;"></menu></code>          </div>
    
        </div>
    

    </td>

      </tr>
    
     </tbody>
    
    </table>
    
    

    </div>

    </div>

    再回到MainActivity.java 中加入OnMenuItemClickListener 的監聽者:

  • 1
        <div class="line number2 index1 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          2
        </div>
    
        <div class="line number3 index2 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          3
        </div>
    
        <div class="line number4 index3 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          4
        </div>
    
        <div class="line number5 index4 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          5
        </div>
    
        <div class="line number6 index5 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          6
        </div>
    
        <div class="line number7 index6 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          7
        </div>
    
        <div class="line number8 index7 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          8
        </div>
    
        <div class="line number9 index8 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          9
        </div>
    
        <div class="line number10 index9 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          10
        </div>
    
        <div class="line number11 index10 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          11
        </div>
    
        <div class="line number12 index11 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          12
        </div>
    
        <div class="line number13 index12 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          13
        </div>
    
        <div class="line number14 index13 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          14
        </div>
    
        <div class="line number15 index14 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          15
        </div>
    
        <div class="line number16 index15 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          16
        </div>
    
        <div class="line number17 index16 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          17
        </div>
    
        <div class="line number18 index17 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          18
        </div>
    
        <div class="line number19 index18 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          19
        </div>
    
        <div class="line number20 index19 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          20
        </div>
    
        <div class="line number21 index20 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          21
        </div>
    
        <div class="line number22 index21 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          22
        </div>
    

    </td>

       <td class="code" style="width:6194px;padding:0px!important;border:0px!important;margin:0px!important;font-size:1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important;min-height:inherit!important;background:none!important;"> 
        <div class="container" style="border:0px!important;margin:0px!important;padding:0px!important;width:auto!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:relative!important;right:auto!important;top:auto!important;vertical-align:baseline!important;font-size:1em!important;min-height:inherit!important;background:none!important;"> 
         <div class="line number1 index0 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">private Toolbar.OnMenuItemClickListener onMenuItemClick = </code>           <code class="js keyword" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:#006699!important;">new</code> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">Toolbar.OnMenuItemClickListener() {</code>          </div>
    
         <div class="line number2 index1 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">@Override</code>          </div>
    
         <div class="line number3 index2 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">public boolean onMenuItemClick(MenuItem menuItem) {</code>          </div>
    
         <div class="line number4 index3 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">    </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">String msg = </code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">""</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">;</code>          </div>
    
         <div class="line number5 index4 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">    </code>           <code class="js keyword" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:#006699!important;">switch</code> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">(menuItem.getItemId()) {</code>          </div>
    
         <div class="line number6 index5 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">      </code>           <code class="js keyword" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:#006699!important;">case</code> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">R.id.action_edit:</code>          </div>
    
         <div class="line number7 index6 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">        </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">msg += </code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"Click edit"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">;</code>          </div>
    
         <div class="line number8 index7 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">        </code>           <code class="js keyword" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:#006699!important;">break</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">;</code>          </div>
    
         <div class="line number9 index8 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">      </code>           <code class="js keyword" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:#006699!important;">case</code> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">R.id.action_share:</code>          </div>
    
         <div class="line number10 index9 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">        </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">msg += </code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"Click share"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">;</code>          </div>
    
         <div class="line number11 index10 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">        </code>           <code class="js keyword" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:#006699!important;">break</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">;</code>          </div>
    
         <div class="line number12 index11 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">      </code>           <code class="js keyword" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:#006699!important;">case</code> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">R.id.action_settings:</code>          </div>
    
         <div class="line number13 index12 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">        </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">msg += </code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">"Click setting"</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">;</code>          </div>
    
         <div class="line number14 index13 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">        </code>           <code class="js keyword" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:#006699!important;">break</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">;</code>          </div>
    
         <div class="line number15 index14 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">    </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">}</code>          </div>
    
         <div class="line number16 index15 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                </code> 
         </div>
    
         <div class="line number17 index16 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">    </code>           <code class="js keyword" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:#006699!important;">if</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">(!msg.equals(</code>           <code class="js string" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:blue!important;">""</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">)) {</code>          </div>
    
         <div class="line number18 index17 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">      </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">Toast.makeText(MainActivity.</code>           <code class="js keyword" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:#006699!important;">this</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">, msg, Toast.LENGTH_SHORT).show();</code>          </div>
    
         <div class="line number19 index18 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">    </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">}</code>          </div>
    
         <div class="line number20 index19 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">    </code>           <code class="js keyword" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:#006699!important;">return</code> 
          <code class="js keyword" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:#006699!important;">true</code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">;</code>          </div>
    
         <div class="line number21 index20 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">  </code>           <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">}</code>          </div>
    
         <div class="line number22 index21 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">};</code>          </div>
    
        </div>
    

    </td>

      </tr>
    
     </tbody>
    
    </table>
    
    

    </div>

    </div>

    將onMenuItemClick監聽者設置給toolbar

    1
        <div class="line number2 index1 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          2
        </div>
    
        <div class="line number3 index2 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          3
        </div>
    
        <div class="line number4 index3 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          4
        </div>
    
        <div class="line number5 index4 alt2" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          5
        </div>
    
        <div class="line number6 index5 alt1" style="border-width:0px 3px 0px 0px!important;border-right-style:solid!important;border-right-color:#6ce26c!important;margin:0px!important;padding:0px 0.5em 0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;text-align:right!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;">
          6
        </div>
    

    </td>

       <td class="code" style="width:6132px;padding:0px!important;border:0px!important;margin:0px!important;font-size:1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important;min-height:inherit!important;background:none!important;"> 
        <div class="container" style="border:0px!important;margin:0px!important;padding:0px!important;width:auto!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:relative!important;right:auto!important;top:auto!important;vertical-align:baseline!important;font-size:1em!important;min-height:inherit!important;background:none!important;"> 
         <div class="line number1 index0 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">setSupportActionBar(toolbar);</code>          </div>
    
         <div class="line number2 index1 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        </code> 
         </div>
    
         <div class="line number3 index2 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">...</code>          </div>
    
         <div class="line number4 index3 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js spaces" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        </code> 
         </div>
    
         <div class="line number5 index4 alt2" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js comments" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;color:#008200!important;">// Menu item click 的監聽事件一樣要設定在 setSupportActionBar 才有作用</code>          </div>
    
         <div class="line number6 index5 alt1" style="border:0px!important;margin:0px!important;padding:0px 1em!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;font-size:1em!important;min-height:inherit!important;white-space:pre!important;"> 
          <code class="js plain" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin:0px;padding:0.2em 0px;line-height:normal;border:0px!important;bottom:auto!important;float:none!important;height:auto!important;left:auto!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;min-height:inherit!important;">toolbar.setOnMenuItemClickListener(onMenuItemClick);</code>          </div>
    
        </div>
    

    </td>

      </tr>
    
     </tbody>
    
    </table>
    
    

    </div>

    </div>

    和 setNavigationIcon 一樣,需要將之設定在 setSupportActionBar 之后才有作用。執行上面的代碼便會得到下面的界面。

    完完整程序見:toolbar_demo_checkpoint3

    5. 總結

    在這樣的架構設計下,ToolBar直接成了Layout中可以控制的東西,相對于過去的actionbar來說,設計與可操控性大幅提升。

    本文上面的解釋中用到的完成代碼:toolbar demo check point 0 ~ 4,請到Github 取得。

    最后再附上一個界面上常用的屬性說明圖:

    這里按照圖中從上到下的順序做個簡單的說明:

    • colorPrimaryDark


      • 狀態欄背景色。

      • 在 style 的屬性中設置。

    • textColorPrimary


      • App bar 上的標題與更多菜單中的文字顏色。

      • 在 style 的屬性中設置。

    • App bar 的背景色


      • Actionbar 的背景色設定在 style 中的 colorPrimary。

      • Toolbar 的背景色在layout文件中設置background屬性。

    • colorAccent


      • 各控制元件(如:check box、switch 或是 radoi) 被勾選 (checked) 或是選定 (selected) 的顏色。

      • 在 style 的屬性中設置。

    • colorControlNormal


      • 各控制元件的預設顏色。

      • 在 style 的屬性中設置

    • windowBackground


      • App 的背景色。

      • 在 style 的屬性中設置

    • navigationBarColor


      • 導航欄的背景色,但只能用在 API Level 21 (Android 5) 以上的版本

      • 在 style 的屬性中設置


    最后需要注意的是:使用material主題的時候,必須設定targetSdkVersion = 21,否則界面看起來是模糊的          

    </div> </div>

     本文由用戶 youyinet 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
     轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
     本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!
  • sesese色