更改主題操作方法:
我們提供的服務(wù)有:網(wǎng)站制作、成都網(wǎng)站建設(shè)、微信公眾號開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認證、北川羌族ssl等。為上1000+企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的北川羌族網(wǎng)站制作公司
1.自帶主題更改:設(shè)置-主題-默認/Pink/Space/主題商店,使用時按照提示下載后即可應(yīng)用。
2.您可以通過應(yīng)用商店或其它方式下載主題(.APK格式)。下載完成后,打開下載的主題軟件,選擇應(yīng)用即可。
Android 應(yīng)用程序中使用自定義主題的方法:
1、新建一個項目 Lesson32_StyleAndTheme。
2、拷貝下面三張 Nine-Patch PNG圖片到res/drawable目錄下:
3、在按鈕的同目錄下建立一個文件btn_custom.xml,把上述3張圖片整合成一個按鈕背景文件,讓三張圖片成為不同狀態(tài)下的按鈕表現(xiàn)效果。具體寫法如下:
?xml?version="1.0"?encoding="utf-8"?
selector?xmlns:android=""??
item?android:drawable="@drawable/btn_red"?android:state_enabled="false"
item?android:drawable="@drawable/btn_orange"?android:state_enabled="true"?android:state_pressed="true"
item?android:drawable="@drawable/btn_orange"?android:state_enabled="true"?android:state_focused="true"
item?android:drawable="@drawable/btn_black"?android:state_enabled="true"
/item/item/item/item/selector
4、在res/values目錄下定義style.xml文件,內(nèi)容如下:
?xml?version="1.0"?encoding="utf-8"?
resources
style?name="BasicButtonStyle"?parent="@android:style/Widget.Button"
item?name="android:gravity"center_vertical|center_horizontal/item
item?name="android:textColor"#ffffffff/item
item?name="android:shadowColor"#ff000000/item
item?name="android:shadowDx"0/item
item?name="android:shadowDy"-1/item
item?name="android:shadowRadius"0.2/item
item?name="android:textSize"16dip/item
item?name="android:textStyle"bold/item
item?name="android:background"@drawable/btn_custom/item
item?name="android:focusable"true/item
item?name="android:clickable"true/item
/style
style?name="BigTextStyle"
item?name="android:layout_margin"5dp/item
item?name="android:textColor"#ff9900/item
item?name="android:textSize"25sp/item
/style
style?name="BasicButtonStyle.BigTextStyle"
item?name="android:textSize"25sp/item
/style
/resources
5、在res/layout/目錄下定義main.xml文件,內(nèi)容如下:
?xml?version="1.0"?encoding="utf-8"?
linearlayout?xmlns:android=""?android:layout_height="fill_parent"?android:layout_width="fill_parent"?android:orientation="vertical"
textview?android:layout_height="wrap_content"?android:layout_width="fill_parent"?android:text="張信哲的熱搜歌曲"
button?android:layout_height="wrap_content"?android:layout_width="wrap_content"?android:text="愛如潮水?"?android:id="@+id/Button01"
/button
/textview/linearlayout
6、在res/values目錄下定義theme.xml文件:
?xml?version="1.0"?encoding="utf-8"?
resources????????
style?name="BasicButtonTheme"
item?name="android:buttonStyle"@style/basicbuttonstyle/item
item?name="android:windowBackground"@android:color/transparent/item??
item?name="android:windowIsTranslucent"true/item??
/style
/resources
7、在AndroidManifest.xml中給整個應(yīng)用程序設(shè)置主題:
?xml?version="1.0"?encoding="utf-8"?
manifest?xmlns:android=""?package="android.basic.lesson32"?android:versioncode="1"?android:versionname="1.0"??
application?android:theme="@style/BasicButtonTheme"?android:label="@string/app_name"?android:icon="@drawable/icon"
activity?android:label="@string/app_name"?android:name=".MainStyleAndTheme"
intent?-filter=""
action?android:name="android.intent.action.MAIN"
category?android:name="android.intent.category.LAUNCHER"
/category/action/intent
/activity
/application
uses?-sdk=""?android:minsdkversion="8"
/uses/manifest
8、程序的最終運行效果圖如下:
在Android中我們經(jīng)常需要設(shè)置屏幕頂部狀態(tài)欄的主題和應(yīng)用頁面保持同一風(fēng)格,本文介紹幾種常用的設(shè)置方案:
首先給出一張圖:
2 2
通過上圖,我們可以通過設(shè)置不同的屬性來達到控制不同位置顏色的目的,下面給出使用示例,修改res/values-19里面的內(nèi)容:
主要是設(shè)置 colorPrimary,colorPrimaryDark這兩個屬性的值來設(shè)置狀態(tài)欄的顏色,需要注意的是:
1:AndroidManifest.xml文件中的targetSdkVersion必須設(shè)置在 21 以上。
2.parent主題必須是 Theme.AppCompat 開頭,兼容包下的主題,所以必須一用 v7 包。
在頂部標題欄設(shè)置屬性值達到風(fēng)格一致的目的
首先修改res/values-v19文件夾下的styles.xml文件內(nèi)容如下(如果沒有可以新建一個):
然后設(shè)置頂部標題控件的兩個屬性:
這時狀態(tài)欄會保持與設(shè)置fitsSystemWindow屬性的控件的背景顏色一致。
本文從網(wǎng)上復(fù)制,給自己做筆記的,摘自:
Android系統(tǒng)自帶樣式(@android:style/) (轉(zhuǎn))
1 android:theme="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen"
布局頁面最上面 不會顯示? android:icon="@drawable/ic_launcher"中的值和android:label="@string/app_name"的值。
2 android:theme="@style/AppTheme"
布局頁面最上面 顯示? android:icon="@drawable/ic_launcher"中的值和android:label="@string/app_name"的值。
其他
在AndroidManifest.xml文件的activity中配置
1、android:theme="@android:style/Theme"
默認狀態(tài),即如果theme這里不填任何屬性的時候,默認為Theme
2、android:theme="@android:style/Theme.NoDisplay"
任何都不顯示。比較適用于只是運行了activity,但未顯示任何東西
3、android:theme="@android:style/Theme.NoTitleBar“
背景主題的沒有標題欄的樣式,默認如果沒有設(shè)置的話,顯示黑背景
4、android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
背景主題的沒有標題欄且全屏的樣式,默認為黑背景
5、android:theme="@android:style/Theme.Black"
默認狀態(tài)下黑背景
6、android:theme="@android:style/Theme.Black.NoTitleBar"
黑背景主題的沒有標題欄的樣式
7、android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
黑背景主題的沒有標題欄且全屏的樣式
8、android:theme="@android:style/Theme.Light"
默認狀態(tài)下亮背景,與上述黑背景Theme.Black相反
9、android:theme="@android:style/Theme.Light.NoTitleBar"
亮背景主題的沒有標題欄的樣式,與Theme.Black.NoTitleBar相反
10、android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"
亮背景主題的沒有標題欄且全屏顯示的樣式,與Theme.Black.NoTitleBa.Fullscreenr相反
11、android:theme="@android:style/Theme.Dialog"
對話框樣式 將整個activity變成對話框樣式出現(xiàn)
12、android:theme="@android:style/Theme.InputMethod"
Window animations that are applied to input method overlay windows
13、android:theme="@android:style/ Theme.Panel"
刪除掉所有多余的窗口裝飾,在一個空的矩形框中填充內(nèi)容,作用范圍相當于把dialog中的所有元素全部去掉,只是一個空的矩形框,且此為默認的樣式
14、android:theme="@android:style/ Theme.Light.Panel"
刪除掉所有多余的窗口裝飾,在一個空的矩形框中填充內(nèi)容,作用范圍相當于把dialog中的所有元素全部去掉,只是一個空的矩形框,且默認是light的樣式
15、android:theme="@android:style/Theme.Wallpaper"
使用墻紙做主題,默認狀態(tài)。
16、android:theme="@android:style/ Theme.WallpaperSettings"
使用墻紙做主題,默認是使用將上一個界面調(diào)暗之后作為主題
17、android:theme="@android:style/ Theme.Light.WallpaperSettings"
使用墻紙做主題,默認Light狀態(tài)
18、android:theme="@android:style/Theme.Wallpaper.NoTitleBar"
使用墻紙做主題,且沒有標題欄
19、android:theme="@android:style/Theme.Wallpaper.NoTitleBar.Fullscreen"
使用墻紙做主題,且沒有標題欄,且全屏顯示
20、android:theme="@android:style/Theme.Translucent"
半透明狀態(tài)下的背景,將運行此activity之前的屏幕作為半透明狀態(tài)作為此activity運行時的樣式。
21、android:theme="@android:style/Theme.Translucent.NoTitleBar"
半透明狀態(tài)下沒有標題欄的背景,將運行此activity之前的屏幕作為半透明狀態(tài)作為此activity運行時的樣式。
22、android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
半透明狀態(tài)下沒有標題欄且全屏的背景,將運行此activity之前的屏幕作為半透明狀態(tài)作為此activity運行時的樣式。
摘自:
android:theme="@android:style/Theme.Dialog" //Activity顯示為對話框模式
android:theme="@android:style/Theme.NoTitleBar" //不顯示應(yīng)用程序標題欄
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" //不顯示應(yīng)用程序標題欄,并全屏
android:theme="Theme.Light " //背景為白色
android:theme="Theme.Light.NoTitleBar" //白色背景并無標題欄
android:theme="Theme.Light.NoTitleBar.Fullscreen" //白色背景,無標題欄,全屏
android:theme="Theme.Black" //背景黑色
android:theme="Theme.Black.NoTitleBar" //黑色背景并無標題欄
android:theme="Theme.Black.NoTitleBar.Fullscreen" //黑色背景,無標題欄,全屏
android:theme="Theme.Wallpaper" //用系統(tǒng)桌面為應(yīng)用程序背景
android:theme="Theme.Wallpaper.NoTitleBar" //用系統(tǒng)桌面為應(yīng)用程序背景,且無標題欄
android:theme="Theme.Wallpaper.NoTitleBar.Fullscreen" //用系統(tǒng)桌面為應(yīng)用程序背景,無標題欄,全屏
android:theme="Theme.Translucent" //透明背景
android:theme="Theme.Translucent.NoTitleBar" //透明背景并無標題
android:theme="Theme.Translucent.NoTitleBar.Fullscreen" //透明背景并無標題,全屏
android:theme="Theme.Panel " //面板風(fēng)格顯示
android:theme="Theme.Light.Panel" //平板風(fēng)格顯示
主題一:Darcula,就是當今最流行的背景主題,
主題二:Intellij,灰白系列,相比第三個windows主題更好看一些,但個人還是覺得Darcula最好。
網(wǎng)站題目:android主題,android主題下載動漫
URL地址:http://jinyejixie.com/article8/dsdiiop.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供用戶體驗、做網(wǎng)站、標簽優(yōu)化、企業(yè)網(wǎng)站制作、網(wǎng)站收錄、域名注冊
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)