第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

Android技術(shù)文檔翻譯--工具屬性(Tools Attributes)

標(biāo)簽:
Android

Tools 属性

为了在XML文件中记录一些信息,Android专门定义了名为tools的XML命名空间。在应用打包的时候这些信息会被自动去掉,所以不会影响运行和下载的包大小。命名空间的URI是http://schemas.android.com/tools,一般以tools作为前缀:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
....

该文档记录了我们当前tools属性的用法.( 注意:这可能会随时改变 )

用途: Lint

用途: Lint

现在我们知道,默认values文件里的字符串使用的是西班牙语,而不是英语。
用途: Lint, Studio (可以在非英语的资源文件中禁用拼写检查)

tools:context

该属性通常被设置在布局文件的根元素上,记录布局文件所关联的Activity(设计时,一个布局可能会被多个部门引用)。这可以用来让布局编辑器知道其默认的主题,因为主题一般都是在清单文件里和与之关联的Activity里定义,而不是在布局文件里。和在清单文件中指定activity的类一样,你也可以使用.开头设置。

<android.support.v7.widget.GridLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context=".MainActivity" ... >

用途:Studio & Eclipse中的布局编辑器以及Lint。

用途: Studio & Eclipse的布局编辑器

tools:listitem / listheader / listfooter

这些属性可以被用在一个<ListView>(或者<GridView>,<ExpandableListView>这些AdapterView的子View)上,用于在设计时指定list元素、list头、list底的布局。工具就会填充一些虚拟的数据显示一个有代表性内容的列表。

<ListView
    android:id="@android:id/list"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:listitem="@android:layout/simple_list_item_2" />

用途: Studio & Eclipse的布局编辑器

tools:showIn

该属性需要设置在被另外一个布局包含的一个布局的根元素中。允许你设置包含该布局的布局文件,并且在设计时,这个被包含的布局将会在其外部的布局里渲染呈现。这允许你在上下文里查看和编辑布局。需要Studio 0.5.8及其以后版本支持。更多信息请参考

用途: Studio布局编辑器

tools:menu

该属性设置在布局的根元素上,作用是配置在Action Bar显示的菜单。Android Studio通过和该布局关联的Activity(通过tools:context找到)的onCreateOptionsMenu()方法尝试找出在Action Bar使用的菜单。者允许你覆盖搜索和已确认状态的菜单。该属性值是一个逗号分割的id列表(不需要@id和其他任何前缀)。你也可以用不带.xml扩展名的xml菜单的文件名。必须是0.8.0及其之后的Studio版本才支持。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:menu="menu1,menu2" />

用途: Studio布局编辑器

tools:actionBarNavMode

概述行设置在布局的根元素上,以配置Action Bar的导航模式。有”standard”, “list” 以及 “tabs”这三个值可供选择,需要0.8.0及其之后的Studio版本支持。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:actionBarNavMode="tabs" />

用途: Studio布局编辑器

其他: 设计时属性

在布局中,任何一个属性都有一个与之对应的内置的Android属性。比如,你能设置一个只在设计时显示的替代文本,但是在实际运行的时候却不显示。要了解更多相信,请参考设计时布局属性

原文链接:http://www.apkbus.com/blog-705730-62792.html

點(diǎn)擊查看更多內(nèi)容
TA 點(diǎn)贊

若覺(jué)得本文不錯(cuò),就分享一下吧!

評(píng)論

作者其他優(yōu)質(zhì)文章

正在加載中
  • 推薦
  • 評(píng)論
  • 收藏
  • 共同學(xué)習(xí),寫下你的評(píng)論
感謝您的支持,我會(huì)繼續(xù)努力的~
掃碼打賞,你說(shuō)多少就多少
贊賞金額會(huì)直接到老師賬戶
支付方式
打開(kāi)微信掃一掃,即可進(jìn)行掃碼打賞哦
今天注冊(cè)有機(jī)會(huì)得

100積分直接送

付費(fèi)專欄免費(fèi)學(xué)

大額優(yōu)惠券免費(fèi)領(lǐng)

立即參與 放棄機(jī)會(huì)
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)

舉報(bào)

0/150
提交
取消