Android開發23 樣式和主題

2021-09-21 19:50:28 字數 2597 閱讀 1547

一、基本概念

作用和網頁開發中的css是一樣的。樣式用在單個控制項上,主題應用在整個應用或乙個或多個activity上。

二、例項**

在res/values資料夾下建立style.xml檔案,該檔案中體現了樣式的繼承。樣式的覆蓋和css一樣,也是就近原則。

<?

xmlversion

="1.0"

encoding

="utf-8"

?>

<

resources

>

<

style

name

="xystyle"

>

<

item

name

="android:textsize"

>

18dp

item

>

<

item

name

="android:textcolor"

>

#ff0000

item

>

style

>

<

style

name

="txtviewstyle"

parent

="xystyle"

>

<

item

name

="android:layout_width"

>

fill_parent

item

>

<

item

name

="android:layout_height"

>

wrap_content

item

>

style

>

<

style

name

="txtviewstyle.child"

>

<

item

name

="android:textcolor"

>

#0d9df0

item

>

style

>

<

style

name

="xytheme"

>

<

item

name

="android:windownotitle"

>

true

item

>

<

item

name

="android:windowfullscreen"

>

?android:windownotitle

item

>

style

>

resources

>

<?

xmlversion

="1.0"

encoding

="utf-8"

?>

<

linearlayout

xmlns:android

=""android:orientation

="vertical"

android:layout_width

="fill_parent"

android:layout_height

="fill_parent"

>

<

textview

android:text

="@string/hello"

style

="@style/txtviewstyle.child"

/>

linearlayout

>

<

android:icon

="@drawable/icon"

android:label

=android:theme

="@style/xytheme"

>

<

activity

android:name

=".mainactivity"

android:label

=>

<

intent-filter

>

<

action

android:name

="android.intent.action.main"

/>

<

category

android:name

="android.intent.category.launcher"

/>

intent-filter

>

activity

>

>

<

uses-sdk

android:minsdkversion

="8"

/>

woshixuye111

jq 04樣式和類操作

1.設定樣式 a 單個樣式 selector css color red selector css opacity 0.4 屬性和屬性值之間用 逗號隔開,並分別 加引號 不帶單位的 純數字除外 b 多個樣式 selector css 設定多個樣式時,引數為 物件,鍵值對形式書寫屬性 屬性值 2.獲採...

CSS3樣式和新特性

css3樣式 1邊框 border radius圓角邊框div border shadow邊框陰影div border image邊框 相容性 div background size div 3字型 font face 擱置 在 css3 之前,web 設計師必須使用已在使用者計算機上安裝好的字型。...

MVC框架(三)樣式和布局

部分 3 新增樣式和統一的外觀 布局 檔案 layout.cshtml 表示應用程式中每個頁面的布局。它位於 views 資料夾中的 shared 資料夾。開啟這個檔案,把其內容替換為 renderbody 在上面的 中,html 幫助器用於修改 html 輸出 url.content url 內容...