ym—— Android 5.0學習之使用Material主題

來源:互聯網
上載者:User

標籤:material主題

前言

建立完模擬器了,我想大家已經迫不及待的想開發Android 5.0的項目了,

看完這篇後我們將可以自訂Material主題了~!

新的material主題提供了什嗎?

可以讓你設定調色盤的系統控制項。

為控制項(設計的)觸摸反饋動畫。

Activity過渡動畫

我們來看一下Android給我提供了多少Material的主題吧~!


看來給我不少常用的主題,但是這些主題遠遠滿足不了我大佬們的需求~!至於為什麼,我想大家都懂得。讓我們來自訂Material主題吧根據官方提供圖片提示的來自訂顏色基調(自訂其他的東西原理一樣)
首先我們來定義幾種不同的顏色
然後新增一個自訂佈景主題繼承Material主題設定對應部位顏色
<?xml version="1.0" encoding="utf-8"?><resources>    <!-- inherit from the material theme -->    <style name="AppTheme" parent="android:Theme.Material">        <item name="android:colorPrimary">@color/color1        </item>        <item name="android:colorPrimaryDark">@color/color2        </item>        <item name="android:textColorPrimary">@color/color3        </item>        <item name="android:windowBackground">@color/color4        </item>        <item name="android:navigationBarColor">@color/color5</item>    </style></resources>
最後在AndroidManifast配置該主題
運行看效果
OK~!搞定,很簡單吧,大家試試吧~!

ym—— Android 5.0學習之使用Material主題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.