亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 1147 | 回復(fù): 0
打印 上一主題 下一主題

[Android] Resources: Style & Themes [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2011-12-22 08:51 |只看該作者 |倒序?yàn)g覽
  1. Docs
    • Applying Styles and Themes
      http://developer.android.com/guide/topics/ui/themes.html
    • System Styles
      http://developer.android.com/reference/android/R.style.html
    • System Themes
      http://developer.android.com/reference/android/R.styleable.html#Theme
    • Style Resources
      http://developer.android.com/guide/topics/resources/style-resource.html
    • Referencing style attributes
      http://developer.android.com/guide/topics/resources/accessing-resources.html#ReferencesToThemeAttributes
    • xxx
  2. Summary
    • What is style
      A style is a set of one or more formatting attributes that you can apply as a unit to individual elements in your layout(View or Window).
      A style can specify properties such as height, padding, font color, font size, background color, and much more. A style is defined in an XML resource that is separate from the XML that specifies the layout.
      For example, you could define a style that specifies a certain text size and color, then apply it to only specific View elements.

    • What is theme
      A theme is a set of one or more formatting attributes that you can apply as a unit to all activities in an application, or just a single activity, rather than an individual View.
      For example, you could define a theme that sets specific colors for the window frame and the panel background, and sets text sizes and colors for menus. This theme can then be applied to specific activities or the entire application.
    • xxx
  3. Style Inherits
    1st way: use parent attribute.
    2nd way: use name attribute with '.' seperated, such as <style name="CodeFont.Red"> which inherits from stule CodeFont.

    If you want to remove an attribute from derived style, you can override the attribute and set "@null" as its value, ie:
    <resources>
        <style name="Theme.NoBackground" parent="android:Theme">
            <item name="android:windowBackground">@null</item>
        </style>
    </resources>

  4. Referencing style attributes
    A style attribute resource allows you to reference the value of an attribute defined in the currently-applied theme.

    To reference a style attribute, the name syntax is
    ?[<package_name>:][<resource_type>/]<resource_name>


    Sample:
    <EditText
        id="text"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textColor="?android:textColorSecondary"
        android:text="@string/hello_world" />

    Here, the android:textColor attribute specifies the name of a style attribute in the current theme. Android now uses the value applied to the android:textColorSecondary style attribute as the value for android:textColor in this widget. Because the system resource tool knows that an attribute resource is expected in this context, you do not need to explicitly state the type (which would be ?android:attr/textColorSecondary)—you can exclude the attr type.

    Another sample:
    <ProgressBar android:id="@+id/progress_horizontal"
            style="?android:attr/progressBarStyleHorizontal"
            android:layout_width="200dip"
            android:layout_height="wrap_content"
            android:max="100"
            android:progress="50"
            android:secondaryProgress="75" />

    <TextView
            style="?android:attr/listSeparatorTextViewStyle"
            android:text="@string/listSeparatorTextViewStyle"
            android:layout_marginTop="5dip"
        />

  5. xxx
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP