位置: 编程技术 - 正文

android中style的学习心得(android style文件)

编辑:rootadmin

推荐整理分享android中style的学习心得(android style文件),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:android styleable,androidstudio的style没有,android style theme,android style theme,androidstudio的style没有,安卓style语法,安卓style语法,android styleable,内容如对您有帮助,希望把文章链接给更多的朋友!

通过学习发现android中界面、元素及动画一般都用到style,关于系统自带的styles.xml文件(我的在D:android-sdk-windowsplatformsandroid-dataresvaluesstyles.xml),源码如下:

<style name="WindowTitle"> <item name="android:singleLine">true</item> <item name="android:textAppearance">@style/TextAppearance.WindowTitle</item> <item name="android:shadowColor">#BB</item> <item name="android:shadowRadius">2.</item> </style> <style name="DialogWindowTitle"> <item name="android:maxLines">1</item> <item name="android:scrollHorizontally">true</item> <item name="android:textAppearance">@style/TextAppearance.DialogWindowTitle</item> </style>

……

以上是关于窗体或对话框样式;

<style name="Widget.ProgressBar.Horizontal"> <item name="android:indeterminateOnly">false</item> <item name="android:progressDrawable">@android:drawable/progress_horizontal</item> <item name="android:indeterminateDrawable">@android:drawable/progress_indeterminate_horizontal</item> <item name="android:minHeight">dip</item> <item name="android:maxHeight">dip</item> <item name="android:mirrorForRtl">true</item> </style> <style name="Widget.SeekBar"> <item name="android:indeterminateOnly">false</item> <item name="android:progressDrawable">@android:drawable/progress_horizontal</item> <item name="android:indeterminateDrawable">@android:drawable/progress_horizontal</item> <item name="android:minHeight">dip</item> <item name="android:maxHeight">dip</item> <item name="android:thumb">@android:drawable/seek_thumb</item> <item name="android:thumbOffset">8dip</item> <item name="android:focusable">true</item> <item name="android:mirrorForRtl">true</item> </style>

……

以上是关于UI控件的样式;

<style name="Animation.Activity"> <item name="activityOpenEnterAnimation">@anim/activity_open_enter</item> <item name="activityOpenExitAnimation">@anim/activity_open_exit</item> <item name="activityCloseEnterAnimation">@anim/activity_close_enter</item> <item name="activityCloseExitAnimation">@anim/activity_close_exit</item> <item name="taskOpenEnterAnimation">@anim/task_open_enter</item>

……

</style>

……

以上是关于Activity切换时动画样式;

<style name="TextAppearance.Widget.ActionBar.Title" parent="@android:style/TextAppearance.Medium"> </style> <style name="TextAppearance.Widget.ActionBar.Subtitle" parent="@android:style/TextAppearance.Small"> </style>

android中style的学习心得(android style文件)

<style name="Widget.PopupMenu" parent="Widget.ListPopupWindow"> </style>

……

以上关于状态栏及弹出菜单样式,可以看出,样式也可以继承,parent对应父样式;

style.name是全局唯一的,其他地方要通过name关联引用的,parent有点类&#;继承。style标签里面的每一个<item />对应的是一个属性及其&#;,一般都是系统自带的属性,如果自定义style是可以包含自定义属性的。

在布局文件中,一般的UI控件若没有显示的设置style=""属性,系统在渲染时会默认给定一个,当然也可以显示指定控件的style属性,如下:

<ProgressBar android:layout_width="fill_parent" android:layout_height="wrap_content" style="@android:style/Widget.ProgressBar.Horizontal" />

<Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="button1" style="@android:style/Widget.Button.Inset" />

引用系统自带的style都是以“@android:style/”开头的&#;[style.name];其实可以看作style是包含很多属性的集合,它作为一个整体加到元素上的;

如果要自定义style也是可以的,在res/values/strings.xml文件里或在values目录下新建一个xxx.xml,写入自己的样式:

<style name="my_progress_style" parent="android:Widget.ProgressBar.Horizontal"> <item name="android:indeterminateOnly" >false</item> <item name="android:progressDrawable">@drawable/progress_layer_list</item> <item name="android:minHeight">5dp</item> <item name="android:maxHeight">5dp</item></style>

<style name="my_button_style" > <item name="android:background" >#ff</item> <item name="android:longClickable">false</item> <item name="android:alpha"></item> <item name="android:height">dp</item> <item name="android:width">dp</item></style>

上面第一个是定义了进度条样式它有继承父样式;第二个是定义了按钮样式,其实也可以用于其他控件,只要里面所有属性都支持;

在布局文件中引用自定义样式:

<ProgressBar android:layout_width="fill_parent" android:layout_height="wrap_content" style="@style/my_progress_style" />

去掉@android:直接使用@style/[style.name]。

大致了解这么多,细节还需再研究研究。

android 中添加字体:java.lang.RuntimeException: native typeface cannot be made 关于android自定义字体我想自行定义内容的字体,用了以下语句:TextViewtv=(TextView)findViewById(R.id.maintitle);//换字体Typefaceface=Typeface.createFromAsset(getAssets(),font

LRU缓存机制 今天在看Android内存优化的文档的时候,有一段提到了LRU内存缓存机制,当时一下没想起来,遂searchinnet.然后知道真相的我眼泪掉下来,%_%大学时候学的

android的focus问题 因为工作关系,涉及到很多的安卓物理键盘引起的Focus问题。汗,我估计在Androidcode这群人里,每天要和Focus问题打交道的少之又少了吧,现在好多应用

标签: android style文件

本文链接地址:https://www.jiuchutong.com/biancheng/376597.html 转载请保留说明!

上一篇:3行程序搞定SVM分类-用JAVA程序调用LibSVM API 最简单的示例

下一篇:android 中添加字体:java.lang.RuntimeException: native typeface cannot be made(android 字体设置)

  • 职工福利费计税税率
  • 全国税务师考试准考证打印
  • 企业所得税缴纳时计提可以吗
  • 开办期的所得税年度申报
  • 在校大学生可以考教师资格证吗
  • 当月销售次月开票怎么申报
  • 应付账款转营业外收入进项税转出
  • 没有发票的福利有哪些
  • 410768金税盘
  • 营改增后房地产公司税种及税率
  • 公司股东没有认缴资金
  • 建筑公司成本发票不够
  • 交易性金融资产的入账价值
  • 防洪基金减免的会计分录怎么写?
  • 负债减少在什么方
  • 成本票最多开多少
  • 烟酒发票可以抵扣所得税吗
  • 月末主营业务收入结转会计分录
  • 退休人员工资所得税纳税调整
  • 以库存抵债的账务处理
  • 对子公司投资应采取的核算方法
  • 背书转让后的电子承兑怎么打印
  • 无租使用房产如何征收企业所得税
  • 债务重组收益会计处理
  • win10开机无限werfault一直刷新
  • QuickBooks - QuickBooks是什么进程 有什么用
  • cpuz.exe
  • 资产减值损失会影响营业利润吗
  • 只交社保不发工资可以吗
  • 无形资产的确认与计量
  • 企业所得税优惠事项管理目录
  • 赞助支出计入应纳税所得额吗
  • 深入解析wordpress
  • vue2 mixin
  • windows pythonpath
  • create_proc_entry
  • php多进程处理大数据
  • php页面跳转可以用header
  • 应付账款调整为其他应付款
  • 银行回单打回来会计要做什么
  • 费用化支出期末一般转入哪个账户?
  • 汇算清缴如何调报表
  • 一般纳税人和小规模公司怎么区分
  • 资本化支出影响营业利润吗
  • 小规模企业没有进项票能开发票吗
  • mongodb如何备份
  • 收到银行贷款发放成功的短信
  • 消费税的账务处理方法
  • 个贷系统平账专户A户付款会计分录
  • 出资方式现金
  • 一般纳税人原材料的入账价值怎么算
  • 车船使用税会计分录怎么写
  • mysql基础概念
  • sql中的join
  • win10预览版0x80072ee2
  • linux使用pip
  • win7那些自启可以禁用
  • macbook系统快捷键
  • mac安装win10键盘失灵
  • linux链接分为什么和什么
  • 电脑显示器无信号键盘灯不亮
  • 电脑操作系统7
  • windows8设置自动关机
  • 联想笔记本出厂编号
  • zmweb.exe是什么进程
  • win8系统出现闪屏
  • win7电脑dns存在问题怎么修复
  • unity3d插件手机版
  • python日历查询系统
  • gradle手动安装
  • jquery.validate 自定义验证方法及validate相关参数
  • ECMAScript5(ES5)中bind方法使用小结
  • sudo提权漏洞
  • python坑人代码
  • javascript怎么用
  • jquery获取table指定的行列
  • 农用三轮车免征增值税文件
  • 污水处理厂房产税优惠政策
  • 税收筹划与避税的性质相同
  • 车船发票什么样子
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设