本文主要是介绍Android AndroidManifest属性,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Android平台定义的主题样式:
android:theme="@android:style/Theme.Dialog" 将一个Activity显示为对话框模式
•android:theme="@android:style/Theme.NoTitleBar" 不显示应用程序标题栏
•android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 不显示应用程序标题栏,并全屏
•android:theme="@android:style/Theme.Light" 背景为白色
•android:theme="@android:style/Theme.Light.NoTitleBar" 白色背景并无标题栏
•android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen" 白色背景,无标题栏,全屏
•android:theme="@android:style/Theme.Black" 背景黑色
•android:theme="@android:style/Theme.Black.NoTitleBar" 黑色背景并无标题栏
•android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" 黑色背景,无标题栏,全屏
•android:theme="@android:style/Theme.Wallpaper" 用系统桌面为应用程序背景
•android:theme="@android:style/Theme.Wallpaper.NoTitleBar" 用系统桌面为应用程序背景,且无标题栏
•android:theme="@android:style/Theme.Wallpaper.NoTitleBar.Fullscreen" 用系统桌面为应用程序背景,无标题栏,全屏
•android:theme="@android:style/Translucent" 半透明效果
•android:theme="@android:style/Theme.Translucent.NoTitleBar" 半透明并无标题栏
•android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" 半透明效果,无标题栏,全屏
•android:theme="@android:style/Theme.Panel"
Android平台定义了三种字体大小:
"?android:attr/textAppearanceLarge"
"?android:attr/textAppearanceMedium"
"?android:attr/textAppearanceSmall"
Android字体颜色:
android:textColor="?android:attr/textColorPrimary"
android:textColor="?android:attr/textColorSecondary"
android:textColor="?android:attr/textColorTertiary"
android:textColor="?android:attr/textColorPrimaryInverse"
android:textColor="?android:attr/textColorSecondaryInverse"
Android的ProgressBar样式:
style="?android:attr/progressBarStyleHorizontal"
style="?android:attr/progressBarStyleLarge"
style="?android:attr/progressBarStyleSmall"
style="?android:attr/progressBarStyleSmallTitle"
分隔符
横向: <View
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="?android:attr/listDivider" />
纵向: <View android:layout_width="1dip"
android:layout_height="fill_parent"
android:background="?android:attr/listDivider" /
CheckBox样式
style="?android:attr/starStyle"
类似标题栏效果的TextView
style="?android:attr/listSeparatorTextViewStyle"
其它有用的样式
android:layout_height="?android:attr/listPreferredItemHeight"
android:paddingRight="?android:attr/scrollbarSize"
style="?android:attr/windowTitleBackgroundStyle"
style="?android:attr/windowTitleStyle"
android:layout_height="?android:attr/windowTitleSize"
android:background="?android:attr/windowBackground"
修改Activity的标题栏样式
如在styles.xml中增加
<resources>
<style name="AutoWindowTitleBackground">
<item name="android:background">#778899</item>
</style>
<style name="autoWindowTitlebar" parent="android:Theme">
<item name="android:windowTitleSize">32dp</item>
<item name="android:windowTitleBackgroundStyle">@style/AutoWindowTitleBackground</item>
</style>
</resources>
接着再修改AndroidManifest.xml文件,找到要自定义标题栏的Activity,添加上android:theme值,比如:
<activity android:name=".MainActivity" android:theme="@style/autoWindowTitlebar">
去掉所有Activity界面的标题栏
修改AndroidManifest.xml
在application 标签中添加android:theme=”@android:style/Theme.NoTitleBar”
Android默认情况下提供了一些实用的主题样式,比如说Theme.Dialog可以让你的Activity变成一个窗口风格,而Theme.Light则让你的整个Activity具有白色的背景,而不是黑色那么沉闷。具体使用方法很简单在Androidmanifest.xml文件中对你的Activity节点上加入些代码,如图1所示:
越来越多互联网企业都在Android平台上部署其客户端,为了提升用户体验,这些客户端都做得布局合理而且美观.......Android的Style设计就是提升用户体验的关键之一。Android上的Style分为了两个方面:
1,Theme是针对窗体级别的,改变窗体样式;
2,Style是针对窗体元素级别的,改变指定控件或者Layout的样式。
Android系统的themes.xml和style.xml(位于系统源代码frameworks\base\core\res\res\values\)包含了很多系统定义好的style,建议在里面挑个合适的,然后再继承修改。
标签: Android SDK
代码片段(5)
[代码] themes.xml
02 | < item name = "windowBackground" >@android:drawable/screen_background_dark</ item > |
03 | < item name = "windowFrame" >@null</ item > |
04 | < item name = "windowNoTitle" >false</ item > |
05 | < item name = "windowFullscreen" >false</ item > |
06 | < item name = "windowIsFloating" >false</ item > |
07 | < item name = "windowContentOverlay" >@android:drawable/title_bar_shadow</ item > |
08 | < item name = "windowTitleStyle" >@android:style/WindowTitle</ item > |
09 | < item name = "windowTitleSize" >25dip</ item > |
10 | < item name = "windowTitleBackgroundStyle" >@android:style/WindowTitleBackground</ item > |
11 | < item name = "android:windowAnimationStyle" >@android:style/Animation.Activity</ item > |
[代码] styles.xml
01 | <? xml version = "1.0" encoding = "UTF-8" ?> |
03 | < style name = "TextView" > |
04 | < item name = "android:textSize" >18sp</ item > |
05 | < item name = "android:textColor" >#008</ item > |
06 | < item name = "android:shadowColor" >@android:color/black</ item > |
07 | < item name = "android:shadowRadius" >2.0</ item > |
10 | < style name = "EditText" > |
11 | < item name = "android:shadowColor" >@android:color/black</ item > |
12 | < item name = "android:shadowRadius" >1.0</ item > |
13 | < item name = "android:background" >@android:drawable/btn_default</ item > |
14 | < item name = "android:textAppearance" >?android:attr/textAppearanceMedium</ item > |
18 | < item name = "android:background" >@android:drawable/edit_text</ item > |
19 | < item name = "android:textAppearance" >?android:attr/textAppearanceMedium</ item > |
[代码] main.xml
01 | <? xml version = "1.0" encoding = "utf-8" ?> |
02 | < LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android" |
03 | android:orientation = "vertical" android:layout_width = "fill_parent" |
04 | android:layout_height = "fill_parent" > |
05 | < TextView android:layout_width = "fill_parent" |
06 | android:layout_height = "wrap_content" android:text = "@string/hello" |
07 | style = "@style/TextView" /> |
08 | < EditText android:id = "@+id/EditText01" android:layout_height = "wrap_content" |
09 | style = "@style/EditText" android:layout_width = "fill_parent" |
10 | android:text = "类似Button的EditText" ></ EditText > |
11 | < EditText android:id = "@+id/EditText02" android:layout_height = "wrap_content" |
12 | android:layout_width = "fill_parent" android:text = "普通的EditText" ></ EditText > |
13 | < Button android:id = "@+id/Button01" android:layout_height = "wrap_content" |
14 | style = "@style/Button" android:layout_width = "fill_parent" android:text = "类似EditText的Button" ></ Button > |
这篇关于Android AndroidManifest属性的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!