当前位置:首页 » 安卓系统 » styleandroid

styleandroid

发布时间: 2025-03-29 03:17:43

① Android TextView怎么引用Style

1 首先需要在res/values目录下创建一个styles.xml的文件

<TextView
style="@style/top_recommend_vod_title_style"/>

② Android系统自带样式Theme总结

本文从网上复制,给自己做笔记的,摘自: http://blog.csdn.net/hongya1109110121/article/details/11985545

Android系统自带样式(@android:style/) (转)

1 android:theme="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen"

布局页面最上面 不会显示  android:icon="@drawable/ic_launcher"中的值和android:label="@string/app_name"的值。

2 android:theme="@style/AppTheme"

布局页面最上面 显示  android:icon="@drawable/ic_launcher"中的值和android:label="@string/app_name"的值。

其他

在数嫌并AndroidManifest.xml文件的activity中配置

1、android:theme="@android:style/Theme"

默认状态,即如果theme这里不填任何属性的时候,默认为Theme

2、android:theme="@android:style/Theme.NoDisplay"

任何都不显示。比较适用于只是运行了activity,但未显示任何东西

3、android:theme="@android:style/Theme.NoTitleBar“

背景主题的没有标题栏者岩的样式,默认如果没有设置的话,显示黑背景

4、android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

背景主题的没有标题栏且全屏的样式,默认为黑背景

5、android:theme="@android:style/Theme.Black"

默认状态下黑背景

6、android:theme="@android:style/Theme.Black.NoTitleBar"

黑背景主题的没有标题栏的样式

7、android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"

黑背景主题的没有标题栏且全屏的样式

8、薯迹android:theme="@android:style/Theme.Light"

默认状态下亮背景,与上述黑背景Theme.Black相反

9、android:theme="@android:style/Theme.Light.NoTitleBar"

亮背景主题的没有标题栏的样式,与Theme.Black.NoTitleBar相反

10、android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"

亮背景主题的没有标题栏且全屏显示的样式,与Theme.Black.NoTitleBa.Fullscreenr相反

11、android:theme="@android:style/Theme.Dialog"

对话框样式 将整个activity变成对话框样式出现

12、android:theme="@android:style/Theme.InputMethod"

Window animations that are applied to input method overlay windows

13、android:theme="@android:style/ Theme.Panel"

删除掉所有多余的窗口装饰,在一个空的矩形框中填充内容,作用范围相当于把dialog中的所有元素全部去掉,只是一个空的矩形框,且此为默认的样式

14、android:theme="@android:style/ Theme.Light.Panel"

删除掉所有多余的窗口装饰,在一个空的矩形框中填充内容,作用范围相当于把dialog中的所有元素全部去掉,只是一个空的矩形框,且默认是light的样式

15、android:theme="@android:style/Theme.Wallpaper"

使用墙纸做主题,默认状态。

16、android:theme="@android:style/ Theme.WallpaperSettings"

使用墙纸做主题,默认是使用将上一个界面调暗之后作为主题

17、android:theme="@android:style/ Theme.Light.WallpaperSettings"

使用墙纸做主题,默认Light状态

18、android:theme="@android:style/Theme.Wallpaper.NoTitleBar"

使用墙纸做主题,且没有标题栏

19、android:theme="@android:style/Theme.Wallpaper.NoTitleBar.Fullscreen"

使用墙纸做主题,且没有标题栏,且全屏显示

20、android:theme="@android:style/Theme.Translucent"

半透明状态下的背景,将运行此activity之前的屏幕作为半透明状态作为此activity运行时的样式。

21、android:theme="@android:style/Theme.Translucent.NoTitleBar"

半透明状态下没有标题栏的背景,将运行此activity之前的屏幕作为半透明状态作为此activity运行时的样式。

22、android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"

半透明状态下没有标题栏且全屏的背景,将运行此activity之前的屏幕作为半透明状态作为此activity运行时的样式。

摘自: http://blog.csdn.net/hongya1109110121/article/details/11985545

③ 为什么 Android 改变标题栏style 之后 主体都变成黑色了

因为你改了style所以都变成默认的了 要把背景也设置style

④ android中怎么创建style

自定义样式方法,可以直接通过定义xml文件来实现不同的样式:
只需要修改button_style文件,同样三种状态分开定义:
Xml代码
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape>
<gradient android:startColor="#0d76e1" android:endColor="#0d76e1"
android:angle="270" />
<stroke android:width="1dip" android:color="#f403c9" />
<corners android:radius="2dp" />
<padding android:left="10dp" android:top="10dp"
android:right="10dp" android:bottom="10dp" />
</shape>
</item>

<item android:state_focused="true">
<shape>
<gradient android:startColor="#ffc2b7" android:endColor="#ffc2b7"
android:angle="270" />
<stroke android:width="1dip" android:color="#f403c9" />
<corners android:radius="州源伏2dp" />
<padding android:left="10dp" android:top="10dp"
android:right="10dp" android:bottom="10dp" />
</shape>
</item>

<item>
<shape>
<gradient android:startColor="#000000" android:endColor="#ffffff"
android:angle="180" />
<stroke android:width="1dip" android:color="#f403c9"册携 />
<corners android:radius="5dip" />
<padding android:left="10dp" android:top="10dp"
android:right="10dp" android:bottom="10dp" />
</裂做shape>
</item>
</selector>

gradient 主体渐变 startColor开始颜色,endColor结束颜色 ,angle开始渐变的角度(值只能为90的倍数,0时为左到右渐变,90时为下到上渐变,依次逆时针类推)
stroke 边框 width 边框宽度,color 边框颜色
corners 圆角 radius 半径,0为直角
padding text值的相对位置

热点内容
达内班深圳java 发布:2025-03-31 19:44:20 浏览:764
怎么发送加密邮件 发布:2025-03-31 19:21:35 浏览:969
存储原油 发布:2025-03-31 19:07:29 浏览:840
我的世界服务器qq群互聊 发布:2025-03-31 19:07:23 浏览:704
abc缓存 发布:2025-03-31 19:06:45 浏览:811
登录2b2t服务器教程电脑版 发布:2025-03-31 19:00:52 浏览:724
钉钉解压器 发布:2025-03-31 19:00:45 浏览:369
多点寻路算法 发布:2025-03-31 18:38:50 浏览:516
平板电脑怎么打开服务器 发布:2025-03-31 18:34:23 浏览:986
ssh批量脚本 发布:2025-03-31 18:33:42 浏览:293