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

微商城网站建设平台合同监控做直播网站

微商城网站建设平台合同,监控做直播网站,江苏有哪些网站建设的公司,预装wordpress主机参考#xff1a; 1.Android:Tools命名空间原来是有大用处的 2.Android中tools属性的使用 3.工具属性参考文档 4. 命名空间介绍 5. 注解 6. lint 7. 资源压缩shrink-resources 目录 一、概述二、引入tools命名空间三、tools 命名空间的作用有哪些#xff1f;四、tools 命名空间…参考 1.Android:Tools命名空间原来是有大用处的 2.Android中tools属性的使用 3.工具属性参考文档 4. 命名空间介绍 5. 注解 6. lint 7. 资源压缩shrink-resources 目录 一、概述二、引入tools命名空间三、tools 命名空间的作用有哪些四、tools 命名空间属性功能详解一、xml 中的错误处理属性1、tools:ignore2、tools:targetApi3、 tools:locale 二、xml视图预览相关属性1、用 tools:xxxx 替代 android:xxxx2、tools:context3、tools:itemCount4、tools:layout5、tools:listitem 、 tools:listheader 、 tools:listfooter6、 tools:showIn7、 tools:menu8、 tools:minValue / tools:maxValue9、 tools:openDrawer10、 tools:sample/* 资源 (三)、资源压缩相关属性 ([Resource shrinking](https://developer.android.google.cn/studio/build/shrink-code?hlzh-cn#shrink-resources) attributes)1、 tools:shrinkMode2、 tools:keep3、 tools:discard 一、概述 Android Studio在tools命名空间中支持一些XML属性来开关设计功能和编译时行为。当构建应用时构建工具会删除这些属性从而不会影响APK的大小和运行行为。 二、引入tools命名空间 LinearLayout xmlns:androidhttp://schemas.android.com/apk/res/androidxmlns:toolshttp://schemas.android.com/tools 三、tools 命名空间的作用有哪些 根据官方文档描述根据其属性的功能类别大致有三种主要功能 xml中的错误处理xml 预览资源压缩 说的通俗一点就是 减少或者避免黄线提示让代码更清爽让编译少报错让预览界面更灵活可以随心所欲的定制预览视图压缩资源文件降低APK体积。 四、tools 命名空间属性功能详解 一、xml 中的错误处理属性 1、tools:ignore 说明应用范围xml中的任意元素作用对象Lint (Lint 是AndroidStudio提供的代码扫描工具)具体作用让Lint 工具在检查代码时忽略指定的错误。取值说明不同的错误对应不同的id这些id 就是 ignore的取值。如MissingTranslation。ignore后面可以同时跟多个id多个id之间使用逗号分割 示例1   Lint 检查时默认语言为 英文如果在 xml 中有中文就会报 MissingTranslation 错误我们加上 tools:ignore 之后即可避免。 string nameshow_all_apps tools:ignoreMissingTranslationAll/string示例2 2、tools:targetApi 说明应用范围xml的任意元素作用对象Lint具体作用同 java 代码中的 TargetApi 注解, 指明某个控件只在指定的API 及更高的版本中生效。这样在使用 Lint 检测时就不会因 minSdkVersion 低于控件出现的版本而报错。取值说明 API 版本号对应的 int值 示例 GridLayout xmlns:androidhttp://schemas.android.com/apk/res/androidxmlns:toolshttp://schemas.android.com/toolstools:targetApi14 3、 tools:locale 说明应用范围resources作用对象Lint, Android Studio editor具体作用指明 resources 中元素的语言类型避免拼写检查或者Lint 检查时报错。这两者中默认的语言类型时英文 es取值说明 示例   我们在 values/strings.xml中指明元素的语言版本。 resources xmlns:toolshttp://schemas.android.com/tools tools:localees二、xml视图预览相关属性 以下属性在xml中定义之后只在预览时会展示正式部署之后并不会展示。类似于 DataBindg 中引用字符串资源时的 default 属性。 1、用 tools:xxxx 替代 android:xxxx 说明应用范围view作用对象Android Studio布局编辑器具体作用将view的任意属性值的 android 前缀替换为 tools 之后就可以实现预览效果。以tools 为命名空间的属性值只在预览时有效。 另外在预览时如果同时有 tools:xxx 和 android:xxx ,则优先展示 tools:xxx 的预览效果, 可参考示例代码2取值说明具体取值以view的属性取值为准 示例代码1   预览时展示指定文本 TextViewandroid:layout_widthwrap_contentandroid:layout_heightwrap_contenttools:text欢迎关注 CnPeng 公众号/示例代码2   tools:text 和 android:text 同时存在在预览时会优先展示 tools:text TextViewandroid:layout_widthwrap_contentandroid:layout_heightwrap_contenttools:text这些在预览时展示并会在预览时优先于 android:text 展示android:text这些在部署之后会展示/ 2、tools:context 说明应用范围xml 中的根布局作用对象Lint, Android Studio布局编辑器具体作用**声明该布局文件默认关联的 activity。**声明之后会在布局编辑器或者预览界面中开启一些与该activity相关的特性比如在写 onClick时直接输入方法名然后点击自动完成代码的快捷键就会提示你在对应activity中创建该方法。This enables features in the editor or layout preview that require knowledge of the activity, such as what the layout theme should be in the preview and where to insertonClickhandlers when you make those from a quickfix .取值说明关联的activity。需要带路径建议与清单文件中注册 activity时的路径保持一致。 示例代码   先声明关联的activity然后直接写 onclick 方法名然后按下自动完成代码的快捷键就会提示在对应的activity中创建该方法。 3、tools:itemCount 说明应用范围RecyclerView作用对象Android Studio 布局编辑器具体作用在 RecyclerView 节点中设置该属性之后会指定在预览界面中绘制/展示几个条目取值说明int 类型数值 示例代码   预览界面展示 4个 条目 4、tools:layout 说明应用范围 fragment作用对象Android Studio 布局编辑器具体作用声明在预览时将哪个布局文件填充到该Fragment取值说明布局id 的引用值 示例代码   在预览时将 testlayout 这个布局文件填充到fragment。testlayout的布局中包含一个 RecyclerView并通过 itemCount 设置的预览时展示的条数为4参考 tools:itemCount 5、tools:listitem 、 tools:listheader 、 tools:listfooter 说明应用范围AdapterView及其子类如ListView作用对象Android Studio 布局编辑器具体作用指明 AdapterView在预览界面中所展示的 条目、头布局、脚步局取值说明布局文件的引用 示例代码 item_spinner.xml ?xml version1.0 encodingutf-8? LinearLayoutxmlns:androidhttp://schemas.android.com/apk/res/androidxmlns:toolshttp://schemas.android.com/toolsandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:gravitycenter_verticalandroid:orientationhorizontalImageViewandroid:layout_widthdimen/dp50android:layout_heightdimen/dp50android:srcdrawable/logotools:ignoreContentDescription/!--ignore 后面根由多个错误id时用逗号分隔 --TextViewandroid:idid/tv_item_suspendRvandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_marginRightdimen/dp10android:gravitycenter_verticalandroid:textabctools:ignoreHardcodedText,RtlHardcoded/!--使用 tools:text 设置预览文本--TextViewandroid:layout_widthwrap_contentandroid:layout_heightwrap_contenttools:text这是设置的预览文本/ /LinearLayout 注意 如果 条目布局中有 TextView及其子类控件 (1) 如果设置了 tools:text , 在预览时会优先展示该值 (2) 如果没有设置 tools:text 但设置了 android:text , 在预览时就会展示android:text 的属性值 (3) 如果都没有设置则会默认使用 item1、item2 填充到 TextView中作为预览文本 6、 tools:showIn 说明应用范围所有 view 的根节点即 布局文件的根节点作用对象Android Studio 布局编辑器具体作用声明该布局文件将会被哪个布局通过 include引用。声明之后在对应的文件中不要忘了用 include引用取值说明布局文件的引用 示例代码   testlayout2.xml 将会被 testlayout 引用。 testlayout2.xml ?xml version1.0 encodingutf-8? TextViewandroid:idid/testFragmentxmlns:androidhttp://schemas.android.com/apk/res/androidxmlns:toolshttp://schemas.android.com/toolsandroid:layout_widthmatch_parentandroid:layout_heightwrap_contenttools:showInlayout/testlayouttools:text预览文本/TextViewtestlayout.xml ?xml version1.0 encodingutf-8? LinearLayoutxmlns:androidhttp://schemas.android.com/apk/res/androidandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentinclude layoutlayout/testlayout2//LinearLayout通过这种方式我们在确认该布局文件在哪里使用了的时候就比较方便了。 7、 tools:menu 说明应用范围布局文件的根节点Any root View作用对象Android Studio 布局编辑器具体作用声明在预览界面中 AppBar 将展示哪些菜单取值说明menu文件的id多个id 之间用逗号间隔。不需要任何前缀和后缀。The value can be one or more menu IDs, separated by commas (without menu/ or any such ID prefix and without the .xml extension) 注意按照官方文档的说明可以传入多个 menu id 。但是实际测试时发现传入多个时右上角并没有什么不同的显示。 8、 tools:minValue / tools:maxValue 说明应用范围NumberPicker作用对象Android Studio 布局编辑器具体作用为 NumberPicker 设置预览时的最小值和最大值取值说明int 型数值 示例说明 9、 tools:openDrawer 说明应用范围DrawerLayout作用对象Android Studio 布局编辑器具体作用在预览界面中将 DrawerLayout 打开。取值说明end、left、right、start。具体说明参考下表 ConstantValueDescriptionend800005Push object to the end of its container, not changing its size.left3Push object to the left of its container, not changing its size.right5Push object to the right of its container, not changing its size.start800003Push object to the beginning of its container, not changing its size. 注意 1、在 DrawerLayout 需要通过 layout_gravity 声明哪一部分作为侧拉窗口其取值也是 end、start、left、right。 2、tools:openDrawer 的取值必须与侧拉窗口的 layout_gravity 的取值一致 ?xml version1.0 encodingutf-8?!--此处 openDrawer 的取值必须与侧拉窗口的 layout_gravity 取值一致-- android.support.v4.widget.DrawerLayoutandroid:idid/numberPickerxmlns:androidhttp://schemas.android.com/apk/res/androidxmlns:toolshttp://schemas.android.com/toolsandroid:layout_widthmatch_parentandroid:layout_heightmatch_parenttools:openDrawerright!--这是未展示侧拉界面时的主体内容--RelativeLayout android:layout_widthmatch_parentandroid:layout_heightmatch_parentTextViewandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_centerInParenttruetools:text这是主内容//RelativeLayout!--这是侧拉窗口中的内容。必须通过 layout_gravity 属性声明这是一个侧拉展示的内容--RelativeLayoutandroid:layout_width100dpandroid:layout_heightmatch_parentandroid:layout_gravityrightandroid:background#f2e67bTextViewandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_centerInParenttrueandroid:ems1tools:text这是要侧拉的东西//RelativeLayout /android.support.v4.widget.DrawerLayout10、 “tools:sample/*” 资源 说明应用范围所有支持显示 text 或者 image 的view控件(Any view that supports UI text or images)作用对象Android Studio 布局编辑器具体作用为View设置占位文本或图片。这其实就是系统预置的一堆字符串和图片资源当你想设置预览文本或者预览图片时如果不想自己去定义直接引用这些系统预置的字符串和图片就可以了取值说明参考下表 属性值说明tools:sample/full_namesFull names that are randomly generated from the combination of tools:sample/first_names andtools:sample/last_names.tools:sample/first_namesCommon first names.tools:sample/last_namesCommon last names.tools:sample/citiesNames of cities from across the world.tools:sample/us_zipcodesRandomly generated US zipcodes.tools:sample/us_phonesRandomly generated phone numbers with the following format: (800) 555-xxxx.tools:sample/loremPlaceholder text that is derived from Latin.tools:sample/date/day_of_weekRandomized dates and times for the specified format.tools:sample/date/ddmmyytools:sample/date/mmddyytools:sample/date/hhmmtools:sample/date/hhmmsstools:sample/avatarsVector drawables that you can use as profile avatars.tools:sample/backgrounds/scenicImages that you can use as backgrounds. 示例代码 在下面的预览图中图标和文本都是直接引用的系统预置的。 (三)、资源压缩相关属性 (Resource shrinking attributes) 下面这些属性可以让我们在 资源压缩时确定哪些资源可以保留或者丢弃也可以让我们开启严格模式的资源引用检查。 The following attributes allow you to enable strict reference checks and declare whether to keep or discard certain resources when using resource shrinking 开启资源压缩时在 module 的build.gradle 文件作如下修改 android {buildTypes {release {shrinkResources true //开启资源压缩。minifyEnabled 也必须为true,否则编译不通过minifyEnabled true //开启代码混淆/压缩proguardFiles getDefaultProguardFile(proguard-android.txt), proguard-rules.pro}} }1、 tools:shrinkMode 说明应用范围resources作用对象开启了资源压缩的构建工具Build tools with resource shrinking具体作用指明 构建工具在压缩资源时使用哪种模式safe mode 、strict mode取值说明safe、strict 模式说明safe保留被显示引用的或者可能通过 Resources.getIdentifier() 被动态引用的资源strict保留 resources 或者 代码中 被显示引用的资源 默认是 safe 模式 (即shrinkModesafe). 如果想使用 strict 模式需要在resources节点中显示声明 shrinkModestrict具体如下 ?xml version1.0 encodingutf-8? resources xmlns:toolshttp://schemas.android.com/tools tools:shrinkModestrict /开启 strict 模式之后, 可以使用 tools:keep 保留那些你不想被移除的资源, 或者使用tools:discard 直接移除资源 2、 tools:keep 说明应用范围resources作用对象开启了资源压缩的构建工具具体作用使用资源压缩去移除未被使用的资源时该属性将允许你指明哪些资源可以被保留比如一些通过Resources.getIdentifier() 间接引用的资源取值说明资源文件的引用 使用时在 resources 目录下创建一个 xml 文件并指定名称如res/raw/keep.xml。创建一个resources 节点并为 tools:keep 赋值其值代表将被保留的资源多个资源之间使用逗号间隔也可以使用 * 作为通配符示例如下 ?xml version1.0 encodingutf-8? resources xmlns:toolshttp://schemas.android.com/tools tools:keeplayout/used_1,layout/used_2,layout/*_3 /3、 tools:discard 说明应用范围resources作用对象开启了资源压缩的构建工具具体作用取值说明  当使用资源压缩工具去除一些无用资源时使用该属性可以指明一些需要手动删除的资源 (比如被引用了但是未能生效的资源或者 Gradle 插件误引用了某些资源被引用). 使用时在 resources 目录下创建一个 xml 文件并指定名称如res/raw/keep.xml。创建一个resources 节点并为 tools:keep 赋值其值代表将被保留的资源多个资源之间使用逗号间隔也可以使用 * 作为通配符示例如下 ?xml version1.0 encodingutf-8? resources xmlns:toolshttp://schemas.android.com/tools tools:discardlayout/unused_1 /
http://www.yutouwan.com/news/251477/

相关文章:

  • 全球最大的购物网站wordpress添加百度云
  • 网站 建设可行性报告如何让百度k掉网站
  • 赤峰网站制作公司全球最顶尖的设计公司
  • 代做动画毕业设计的网站手机下载国外网页视频
  • 做网站推广手机上怎么赚钱啊 正规
  • 做网站 视频加载太慢品牌设计开题报告
  • 网站开发工具安卓版做网站就是做信息整合
  • 医院网站建设城乡建设部官网查证
  • 网站快照明天更新是什么情况学校网站前置审批
  • 网站建设对比分析山西建设监理协会官方网站
  • 网站如何做才可以微信直接登录系统开发应注重对反洗钱系统进行
  • 带会员中心WordPress免费主题周口seo 网站
  • 行业数据网站自助建站工具软件
  • 南宁做网站网站类网站建设
  • 手机网站营销的网站南昌有做网站的吗
  • 佛山小学网站建设呼和浩特最好的互联网公司
  • 南京 推广 网站建设网站建设修改建议
  • IT男网站建设网站怎么看被百度收录
  • 义务 网站建设国内最大的搜索引擎
  • 做网站怎么买域名wordpress站点logo
  • 个人网站需要备案做app公司
  • 广州网站建设易得营业执照咋做网等网站
  • 大连建设网中标公司优化大师官方下载
  • 沙井网站设计wordpress好不好
  • 惠州做棋牌网站建设哪家好建设一个普通的网站需要多少钱
  • 十大网站黄页上海如何批量建站
  • 网站绝对路径301资阳网站建设公司
  • 大气网站背景提供石家庄网站推广
  • 别人买了域名做违法网站装饰设计乙级资质承接范围
  • 建设网站的网站空间中企动力科技股份有限公司扬州分公司