`
ch_kexin
  • 浏览: 909516 次
  • 性别: Icon_minigender_2
  • 来自: 青岛
社区版块
存档分类
最新评论

android中的style部分属性值介绍【一】

 
阅读更多

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) 资源

    类型资源的核心概念在于样式(Style),它是一系列属性值的集合,可以被应用到不同的视图元素上。在Android中,样式通常定义在res/values目录下的styles.xml文件中。下面我们将深入探讨类型资源的使用、定义以及其在...

    android change style

    对于其他View,可能需要直接设置对应的属性值,例如`styledAttributes.getColor(index, fallbackColor)`和`styledAttributes.getDimensionPixelSize(index, fallbackSize)`。 4. **释放资源**:在使用完TypedArray...

    Android自定义Attr属性

    首先,自定义Attr涉及到的主要步骤包括:定义属性、在资源文件中声明属性、解析属性值以及在代码中使用属性。让我们逐一探讨这些步骤: 1. **定义属性**: 在res/values目录下创建一个attr.xml文件(如果没有的话...

    android style and theme

    然后,为**Style**中的每个属性添加一个`&lt;item&gt;`元素,该元素具有一个名称和一个值。 下面是一个简单的**Style**示例: ```xml &lt;style name="CodeFont" parent="@android:style/TextAppearance.Medium"&gt; ...

    android text style设置

    本示例“android text style设置”着重于如何在TextView中对特定部分的文本进行样式定制,如改变颜色、设置加粗、调整背景色、修改字体大小、添加下划线或删除线等。下面将详细解释这些知识点,并通过`...

    Android 自定义属性及其引用

    总的来说,Android自定义属性及其引用是开发者工具箱中的重要组成部分,它们提供了强大的定制能力,使得我们可以根据项目需求创建出独具特色的用户界面。无论是对控件、布局还是其他组件进行扩展,自定义属性都能...

    Android开发之ProgressBar及其style样式的使用.zip

    在Android开发中,ProgressBar是一个非常重要的组件,它用于显示进度或加载状态,用户可以直观地看到后台任务的执行情况。本教程将详细讲解如何在Android应用中使用ProgressBar及其style样式,特别关注使用Kotlin...

    android 动态设值progressBar值

    在Android开发中,ProgressBar是一个非常常见的组件,用于展示任务的进度或者加载状态。动态地设置ProgressBar的值可以为用户提供实时的反馈,使界面更具交互性。本篇文章将深入探讨如何根据属性来调节ProgressBar的...

    Android style简单学习应用示例.zip

    1. **样式定义**: 在Android中,样式是一组属性值,通常存储在`res/values/styles.xml`文件中。样式可以定义控件的外观,如字体大小、颜色、背景等。一个样式可以包含多个属性,例如`textColor`、`backgroundColor`...

    android Ui 属性

    Android UI属性是指在XML布局文件中定义的各种属性,用于控制控件和布局的外观和行为。下面我们将深入探讨Android UI属性及其应用。 一、基本布局属性 1. `layout_width` 和 `layout_height`:这两个属性定义了...

    Android Theme和Styles内部定义解析.txt

    在提供的部分代码示例中,我们可以看到如何定义一个名为`cwjTheme`的主题: ```xml &lt;style name="cwjTheme" parent="android:Theme.Light"&gt; &lt;item name="android:windowNoTitle"&gt;true &lt;item name="android:...

    Android自定义Style实现方法

    在Android开发中,自定义Style是一种常见的做法,它允许开发者创建自己的样式模板,以便在多个组件之间统一视觉效果,减少重复代码,并提高代码的可维护性。以下是对如何在Android中实现自定义Style的详细解释: ...

    Android TextView 属性文档

    在Android开发中,TextView是一个至关重要的控件,它用于显示文本。深入理解TextView的属性能够帮助开发者实现丰富的文本展示效果,提高应用的用户体验。以下是对TextView的一些主要属性及其功能的详细解释: 1. **...

    android 属性汇总.rar

    以上只是一部分可能包含在"android 属性汇总"中的知识点。实际文件中可能有更详尽的列表,包括Android的布局管理器属性、自定义视图属性、触摸事件处理、数据绑定以及更多高级特性的属性。学习和理解这些属性对于...

    Android源码——style简单学习应用示例.zip

    在Android中,样式是一组属性值,通常用于设置View或Activity的外观。它们可以定义在XML文件中,通常位于`res/values`目录下的`styles.xml`文件。这样,我们就可以在多个地方重用这些样式,而无需在每个视图中重复...

    Android_样式(style)&主题(theme)&显示单位

    在Android开发中,样式(style)和主题(theme)是两个关键的概念,它们用来统一和管理应用程序的视觉表现。样式可以看作是一组预定义的属性集合,用于控制UI组件的外观,比如字体颜色、大小、背景等。而主题则是...

    AttrTest android自定义属性

    在自定义视图的构造函数或者`onInitializeAccessibilityNodeInfo`方法中,使用`TypedArray`来获取并解析这些属性值: ```java public class MyCustomView extends View { private int mCustomColor; private ...

    Android实现进度条(ProgressBar)的功能与用法

    对于水平进度条,可以通过设置`android:max`属性来定义最大值,并通过`android:progress`或在代码中动态设置`setProgress()`来调整当前进度。例如,设置最大值为100,初始进度为50: ```xml android:id="@+id/bar...

Global site tag (gtag.js) - Google Analytics