当前位置: 首页 > news >正文

怎样把网站打包做百度小程序上海宝山网站制作

怎样把网站打包做百度小程序,上海宝山网站制作,wordpress默认播放器怎么用,招聘 负责网站开发首先&#xff0c;style和theme都是资源&#xff0c;android提供了很多这样的默认资源。你可以来使用它们。同时你也可以自己定义style和 theme。这非常的简单&#xff0c;只需要在res/values/这个路径里面新建一个.xml文件&#xff0c;而且他的根节点必须 是<resources>.…

首先,style和theme都是资源,android提供了很多这样的默认资源。你可以来使用它们。同时你也可以自己定义style和 theme。这非常的简单,只需要在res/values/这个路径里面新建一个.xml文件,而且他的根节点必须 是<resources>.对每一个style和 theme,给<style>element增加一个全局唯一的名字,也可以选择增加一个父类属性,我们写的style和theme就会继承 这个父类的属性。style和theme的定义格式相同。不过style是针对view来说的,比如TextView,EditText这些,而 theme必须针对整个activity或者整个程序,你必须在AndroidManifest.xml中的<application>或 者<activity>中定义。 

先来看看style,比如如下一段代码:

 

[xhtml] view plaincopy
  1. <?xml version="1.0" encoding="utf-8"?><resources>    <mce:style name="CodeFont" parent="@android:style/TextAppearance.Medium"><!-- 
  2.         <item name="android:layout_width">fill_parent</item>        <item name="android:layout_height">wrap_content</item>        <item name="android:textColor">#00FF00</item>        <item name="android:typeface">monospace</item>     
  3. --></mce:style><style name="CodeFont" parent="@android:style/TextAppearance.Medium" mce_bogus="1">        <item name="android:layout_width">fill_parent</item>        <item name="android:layout_height">wrap_content</item>        <item name="android:textColor">#00FF00</item>        <item name="android:typeface">monospace</item>    </style></resources>  

 

 

可以看到这个style 的名字为CodeFont。 parent后面就是父类的style, CodeFont继承这个父类的属性。可以看到这个父类的style是android中默认的,你也可以继承你自定义的style,这时候不需要再写 parent属性,而是使用ContFont.red这样的方式,而且你可以继续继承,写成ContFont.red.small。 接下来每一个item定义一个属性。定义属性的最好方法就是在api文档里找到这个view的xml属性,比如在EditText中有InputType 这个属性,那么在你的style里面你就可以来定义它。

 

 

 

这样一个style就写好了。

 

使用也非常简单,我们只要在写我们的view时,加入style标签就可以了,就像这样

 

[xhtml] view plaincopy
  1. <TextView    style="@style/CodeFont" mce_style="@style/CodeFont"    android:text="@string/hello" />  

 

 

面讲讲主题,前面已经说了。主题需要在AndroidManifest.xml中注册。如果你想整个程序都使用这个主题,你可以这样写

 

[xhtml] view plaincopy
  1. <application android:theme="@style/CustomTheme">  

 

 

 

如果你只需要在某个Activity中使用主题,那么只要在Activity标签中写入android:theme=就可以了,android有很多好的默认主题,比如

 

[xhtml] view plaincopy
  1. <activity android:theme="@android:style/Theme.Dialog">  

 

 

 

这就会使你的整个Activity变成一个对话框形式,或者,如果你希望背景是透明的,可以这样写

 

[xhtml] view plaincopy
  1. <activity android:theme="@android:style/Theme.Translucent">  

 

 

 

同样的我们也可以继承父类theme,写法和style一样,就不赘述了。当然,和style一样,你也可以自己定义一个theme,写个例子

 

[xhtml] view plaincopy
  1. <?xml version="1.0" encoding="utf-8"?><resources> <mce:style name="CustomTheme"><!-- 
  2.  <item name="android:windowNoTitle">true</item> <item name="windowFrame">@drawable/screen_frame</item> <item name="windowBackground">@drawable/screen_background_white</item> <item name="panelForegroundColor">#FF000000</item> <item name="panelBackgroundColor">#FFFFFFFF</item> <item name="panelTextColor">?panelForegroundColor</item> <item name="panelTextSize">14</item> <item name="menuItemTextColor">?panelTextColor</item> <item name="menuItemTextSize">?panelTextSize</item>  
  3. --></mce:style><style name="CustomTheme" mce_bogus="1"> <item name="android:windowNoTitle">true</item> <item name="windowFrame">@drawable/screen_frame</item> <item name="windowBackground">@drawable/screen_background_white</item> <item name="panelForegroundColor">#FF000000</item> <item name="panelBackgroundColor">#FFFFFFFF</item> <item name="panelTextColor">?panelForegroundColor</item> <item name="panelTextSize">14</item> <item name="menuItemTextColor">?panelTextColor</item> <item name="menuItemTextSize">?panelTextSize</item> </style></resources>  

 

 

 

如果你要在java代码中加载主题的话,只要用setTheme(R.style.CustomTheme)就可以了,不过记得一定要在初始化任何view之前,比如一定要放在我们常用的setContentView()之前。通常,我们不建议这么做。

转载于:https://www.cnblogs.com/xingmeng/archive/2012/08/23/2652060.html

http://www.lbrq.cn/news/2720197.html

相关文章:

  • 软件企业网站建设栏目结构图产品关键词
  • 济南网站开发培训班网页设计代做
  • web网站开发与实现深圳网站设计公司排行
  • 动态网站设计的目的苏州关键词seo排名
  • 如何给自己做的网站留后门怎么推广网址
  • 网站开发需求分析用的图在线生成个人网站
  • 抚州市企业网站建设长沙seo优化哪家好
  • 赣州做网站的公司有哪家好长春网站建设制作
  • 做网站后台需要学什么网络舆情管控
  • 网站建设咨询公司推荐成人英语培训
  • 谷歌sem推广搜索引擎优化的简写是
  • 自适应网站可以做伪静态页面吗百度网盘搜索神器
  • 长沙可以做网站的公司seo好seo
  • 代理做减肥网站新闻摘抄2022最新5篇
  • 宁波建设网站公司免费引流推广怎么做
  • 怎么做优惠网站百度推广点击一次多少钱
  • 龙岩做网站推广网推公司干什么的
  • wordpress的插件下载地址武汉seo优化分析
  • 企业网站推广的策略有哪些央视网新闻
  • 去网站做dnf代练要押金吗百度网站首页入口
  • 网站建设和优化的好处软文范例100字以内
  • 做网站需要准备的工具外汇交易平台
  • 河南靠谱seo电话宁波seo搜索引擎优化
  • 廊坊做网站多少钱腾讯朋友圈广告投放价格
  • 长沙正规网站制作公司做网页用什么软件好
  • 修改wordpress后台默认地址优化设计三年级上册语文答案
  • 百度做网站投广告百度关键词挖掘工具爱站网
  • 做外贸的几个网站营销方式有哪几种
  • 网站建设怎么插入邮箱韩国热搜榜
  • 一个网站百度百科怎么做网络营销和传统营销的区别
  • Jenkins+Python自动化持续集成详细教程
  • Redis 官方提供免费的 30 MB 云数据库
  • 阿里云TranslateGeneral - 机器翻译SDK-自己封账单文件版本—仙盟创梦IDE
  • 【深度学习计算性能】04:硬件
  • QT6(创建第一个QT项目)
  • 普通电脑与云电脑的区别有哪些?全面科普