freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

android系統(tǒng)外文翻譯3-android(存儲(chǔ)版)

2025-02-28 06:37上一頁面

下一頁面
  

【正文】 edux extends Activity implements { Button btn。 剩下的部分 在原始的 Now演示中,按鈕的表面便會(huì)顯示當(dāng)前的時(shí)間,這將反映當(dāng)按鈕被最后按下時(shí)顯示的時(shí)間(或者如果在按鈕尚未被按下時(shí)顯示)。在上一節(jié)的 XML布局的例子中, +id是按鈕控件的標(biāo)識(shí)符。將這些屬性將在第 7章中詳解。而“隨大流”并不一定是最好的政策,但他們有優(yōu)勢幫助從任何其他 XML為中心的觀點(diǎn)描述語言輕松進(jìn)入 Android。 也許最大的原因是為了在視圖定義 中協(xié)助工具的建立,如 IDE中一個(gè) GUI創(chuàng)建者像 Eclipse或者一個(gè)像 DroidDraw1設(shè)計(jì) GUI圖形用戶界面建設(shè)者。對(duì) XML元素的屬性,描述一個(gè)部件應(yīng)如何看或者一個(gè)容器應(yīng)如何運(yùn)轉(zhuǎn)。動(dòng)態(tài)的小部件實(shí)例保留更多,情況復(fù)雜,小工具在編譯時(shí)不為人所知(例如,在數(shù)據(jù)檢索了互聯(lián)網(wǎng)基礎(chǔ)上將單選按鈕填充柱。這個(gè)工具應(yīng)自動(dòng) 調(diào)用你的 Android工具鏈(例如, Eclipse中, Ant’ s )。此外,保持生成的 XML定義從手寫的 Java代碼中分離,使得某人定制的來源意外重新生成不太可能。如果您創(chuàng)建自己的部件作為 子小部件,您也將需要提供一個(gè)完整的包聲明(如)。所有的這本書余下的章節(jié)將使用 XML布局,所以還有數(shù)十種更復(fù)雜的其他布局實(shí)例,請(qǐng)前進(jìn)到第七章仔細(xì)閱讀。 這是相同的 setContentView(),我們前面使用,通過它的一個(gè)視圖子類的實(shí)例(在這種情況下,一個(gè)按鈕)。 import 。 btn=(Button)findViewById()。既然我們 發(fā)現(xiàn)按鈕 為 +id/button,我 們可以參 考按鈕的 標(biāo)識(shí)符。更常見的,雖然, 你將通過添加一個(gè) TextView元素到布局來在 XML布局文件中創(chuàng)建標(biāo)簽,與一個(gè)Android:文本屬性來設(shè)置標(biāo)簽的本身價(jià)值。這些通常引用一個(gè)可繪制的資源,在講資源的這個(gè)章節(jié)中更詳細(xì)地描述了。如果你想創(chuàng)建自己的輸入 法計(jì)劃(如郵政編碼,社會(huì)安全號(hào)碼),您需要?jiǎng)?chuàng)建自己的執(zhí)行情況InputMethod接口,然后通過 android設(shè)定字段來使用: inputMethod。 EditText fld=(EditText)findViewById()。在這兩種狀態(tài)之間點(diǎn)擊復(fù)選框切換來 指示選擇(例如,“添加快遞到我的命令”)。 (this)。 像復(fù)選框, RadioButton從 CompoundButton中繼承,從而繼承了 TextView。 視圖中最有可能被使用的某些屬性,包括: ? Controls the focus sequence: ? android:nextFocusDown ? android:nextFocusLeft ? android:nextFocusRight ? android:nextFocusUp ? android:visibility, which controls whether the widget is initially 第 17 頁 共 35 頁 visible ? android:background, which typically provides an RGB color value (., 00FF00 for green) to serve as the background for the widget 您可以切換是否通過 setEnabled()啟用了一個(gè)小裝置,看看它是否是通過isEnabled()啟用的。 import 。updateTime()。 setContentView()。 } public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { (This checkbox is: checked)。 Override public void onCreate(Bundle icicle) { (icicle)。 import 。 Override public void onCreate(Bundle icicle) { (icicle)。 為了幫助操縱部件樹和容器,組成一個(gè) activity的整體視圖,你可以使用: ? getParent() to find the parent widget or container ? findViewById() to find a child widget with a certain ID ? getRootView() to get the root of the tree (., what you provided to the activity via setContentView()) 第 18 頁 共 35 頁 Beginning Android Mark L. Murphy write Using XMLBased Layouts While it is technically possible to create and attach widgets to our activity purely through Java code, the way we did in Chapter 4, the more mon approach is to use an XMLbased layout file. Dynamic instantiation of widgets is reserved for more plicated scenarios, where the widgets are not know n at piletime (e g., populating a column of radio buttons based on data retrieved off the Inter). With that in mind, it’s time to break out the XML and learn how to lay out Android activities that way. What Is an XMLBased Layout? As the name suggests, an XMLbased layout is a specification of widgets’ relationships to each other—and to their containers (more on this in Chapter 7)—encoded in XML format. Specifically, Android considers XMLbased layouts to be resources, and as such layout files are stored in the res/layout directory inside your Android project. Each XML file contains a tree of elements specifying a layout of widgets and their containers that make up one view hierarchy. The attributes of the XML elements are properties, describing how a widget should look or how a container should behave. For example, if a Button element has an attribute value of android:textStyle = bold, that means that the text appearing on the face of the button should be rendered in a boldface font style. Android’s SDK ships with a tool (aapt) which uses the layouts. This tool should be automatically invoked by your Android tool chain (., Eclipse, Ant’s ). Of particular importance to you as a developer is that aapt generates the source file within your project, allowing you to access layouts and widgets within those layouts directly from your Java code. Why Use XMLBased Layouts? Most everything you do using XML layout files can be achieved through Java 第 19 頁 共 35 頁 code. For example, you could use setTypeface() to have a button render its text in bold, instead of using a property in an XML layout. Since XML layouts are yet another file for you to keep track of, we need good reasons for using such files. Perhaps the biggest reason is to assist in the creation of tools for view definition, such as a GUI builder in an IDE like Eclipse or a dedicated Android GUI designer like DroidDraw 1. Such GUI builders could, in principle, generate Java code instead of XML. The challenge is rereading the UI definition to support edits—that is far simpler if the data is in a structured format like XML than in a programming language. Moreover, keeping generated XML definitions separated from handwritten Java code makes it less likely that somebody’s customcrafted source will get clobbered by accident when the generated bits get regenerated. XML forms a nice middle ground between something that is easy for toolwriters to use and easy for programmers to work with by hand as needed. Also, XML as a GUI definition format is being more monplace. Microsoft’s XAML2, Adobe’s Flex3, and Mozilla’s XUL4 all take a similar approach to that of Android: put layout details in an XML file and put programming smarts in source files (., JavaScript for XUL). Many lesswellknown GUI frameworks, such as ZK5, also use XML for view definition. While “following the herd” is not necessarily the best policy, it does have the advantage of helping to ease the transition into Android from any other XMLcentered view description language. OK, So What Does It Look Like? Here is the Button from the previous chapter’s sample application, converted into an XML layout file, found in the Layou
點(diǎn)擊復(fù)制文檔內(nèi)容
公司管理相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1