转自:http://blog.sina.com.cn/s/blog_70c759fd01013phv.html
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”
相关推荐
类型资源的核心概念在于样式(Style),它是一系列属性值的集合,可以被应用到不同的视图元素上。在Android中,样式通常定义在res/values目录下的styles.xml文件中。下面我们将深入探讨类型资源的使用、定义以及其在...
对于其他View,可能需要直接设置对应的属性值,例如`styledAttributes.getColor(index, fallbackColor)`和`styledAttributes.getDimensionPixelSize(index, fallbackSize)`。 4. **释放资源**:在使用完TypedArray...
首先,自定义Attr涉及到的主要步骤包括:定义属性、在资源文件中声明属性、解析属性值以及在代码中使用属性。让我们逐一探讨这些步骤: 1. **定义属性**: 在res/values目录下创建一个attr.xml文件(如果没有的话...
本示例“android text style设置”着重于如何在TextView中对特定部分的文本进行样式定制,如改变颜色、设置加粗、调整背景色、修改字体大小、添加下划线或删除线等。下面将详细解释这些知识点,并通过`...
然后,为**Style**中的每个属性添加一个`<item>`元素,该元素具有一个名称和一个值。 下面是一个简单的**Style**示例: ```xml <style name="CodeFont" parent="@android:style/TextAppearance.Medium"> ...
总的来说,Android自定义属性及其引用是开发者工具箱中的重要组成部分,它们提供了强大的定制能力,使得我们可以根据项目需求创建出独具特色的用户界面。无论是对控件、布局还是其他组件进行扩展,自定义属性都能...
本教程将详细讲解如何在Android应用中使用ProgressBar及其style样式,特别关注使用Kotlin进行实现。 一、ProgressBar的基本使用 ProgressBar在Android中分为两种类型:垂直和水平。默认情况下,它是水平的,可以...
在XML布局文件中,可以使用`android:progressDrawable`属性来指定自定义的进度条样式。创建一个自定义的`drawable`资源文件,例如`progress_bar_style.xml`: ```xml <layer-list xmlns:android=...
1. **样式定义**: 在Android中,样式是一组属性值,通常存储在`res/values/styles.xml`文件中。样式可以定义控件的外观,如字体大小、颜色、背景等。一个样式可以包含多个属性,例如`textColor`、`backgroundColor`...
这将自动为TextView设置相应的属性值,如30px的文字大小、#1110CC的文字颜色,以及150dip的宽和高。 在`MainActivity`中,我们没有对自定义Style做任何直接操作,因为它的作用主要体现在布局文件中。`onCreate()`...
Android UI属性是指在XML布局文件中定义的各种属性,用于控制控件和布局的外观和行为。下面我们将深入探讨Android UI属性及其应用。 一、基本布局属性 1. `layout_width` 和 `layout_height`:这两个属性定义了...
### Android Theme和Styles内部定义解析 ...通过以上的详细介绍,相信你已经对Android中的`Theme`和`Styles`有了更深入的理解。在实际开发过程中灵活运用这些技巧,将会大大提升你的开发效率和应用质量。
在Android开发中,属性系统是构建用户界面和控制应用程序外观与行为的核心部分。这份"android 属性汇总.rar"文件很可能是包含了一份详细的Android XML属性清单,涵盖了从布局到视图,从主题到动画的各种属性。这里,...
【Android TextView 属性详解】 在Android开发中,TextView是一个至关重要的控件,它用于显示文本。深入理解TextView的属性能够帮助开发者实现丰富的文本展示效果,提高应用的用户体验。以下是对TextView的一些主要...
在Android中,样式是一组属性值,通常用于设置View或Activity的外观。它们可以定义在XML文件中,通常位于`res/values`目录下的`styles.xml`文件。这样,我们就可以在多个地方重用这些样式,而无需在每个视图中重复...
对于水平进度条,可以通过设置`android:max`属性来定义最大值,并通过`android:progress`或在代码中动态设置`setProgress()`来调整当前进度。例如,设置最大值为100,初始进度为50: ```xml android:id="@+id/bar...
在Android开发中,样式(style)和主题(theme)是两个关键的概念,它们用来统一和管理应用程序的视觉表现。样式可以看作是一组预定义的属性集合,用于控制UI组件的外观,比如字体颜色、大小、背景等。而主题则是...
在自定义视图的构造函数或者`onInitializeAccessibilityNodeInfo`方法中,使用`TypedArray`来获取并解析这些属性值: ```java public class MyCustomView extends View { private int mCustomColor; private ...