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

正文內(nèi)容

android系統(tǒng)外文翻譯3-android-在線瀏覽

2025-03-24 06:37本頁(yè)面
  

【正文】 :”一個(gè)填充姓名前的標(biāo)簽)。更常見的,雖然, 你將通過(guò)添加一個(gè) TextView元素到布局來(lái)在 XML布局文件中創(chuàng)建標(biāo)簽,與一個(gè)Android:文本屬性來(lái)設(shè)置標(biāo)簽的本身價(jià)值。 TextView有許多相關(guān)的其他標(biāo)簽屬性,如: ? android:typeface to set the typeface to use for the label (., monospace) ? android:textStyle to indicate that the typeface should be made bold (bold), italic (italic), or bold and italic (bold_italic) ? android:textColor to set the color of the label’s text, in RGB hex format (., FF0000 for red) 例如,在 Basic/Label項(xiàng)目中,你將找到下列布局文件: ?xml version= encoding=utf8? TextView xmlns:android= android:layout_width=fill_parent android:layout_height=wrap_content 第 7 頁(yè) 共 35 頁(yè) android:text=You were expecting something profound? / 正如你看到的圖 61, 圖 61 示例應(yīng)用程序的 LabelDemo 只是單獨(dú)的布局,由 android的項(xiàng)目生成器提供的 Java源的(如activityCreator),生成應(yīng)用程序。按鈕是文本視圖的一個(gè)子類,所以一切都在上一節(jié)討論了,按鈕格式所面臨的問(wèn)題仍然成立。 正如名稱所暗示的,他 們是分別對(duì)于文本視圖和按鈕基于圖像的類似物。這些通常引用一個(gè)可繪制的資源,在講資源的這個(gè)章節(jié)中更詳細(xì)地描述了。 第 8 頁(yè) 共 35 頁(yè) ImageButton控件,一個(gè) ImageView子類,混合在標(biāo)準(zhǔn)按鈕行為中,應(yīng)對(duì)點(diǎn)擊和諸如此類的東西。 ?xml version= encoding=utf8? ImageView xmlns:android= android:id=+id/icon android:layout_width=fill_parent android:layout_height=fill_parent android:adjustViewBounds=true android:src=drawable/molecule / 結(jié)果,只用代碼生成 activity,如圖 62所示。在 Android中,他們通過(guò) EditText部件運(yùn)行,它是標(biāo)簽的一個(gè)子類 TextView。如果你想創(chuàng)建自己的輸入 法計(jì)劃(如郵政編碼,社會(huì)安全號(hào)碼),您需要?jiǎng)?chuàng)建自己的執(zhí)行情況InputMethod接口,然后通過(guò) android設(shè)定字段來(lái)使用: inputMethod。對(duì)于這一項(xiàng)目, : package 。 import 。 public class FieldDemo extends Activity { 第 10 頁(yè) 共 35 頁(yè) Override public void onCreate(Bundle icicle) { (icicle)。 EditText fld=(EditText)findViewById()。 you may not use this file + except in pliance with the License. You may + obtain a copy of the License at + } } 結(jié)果,一旦建成并投入安裝成模擬器,如圖 63所示。由于本章中的所有演示共享 ,您將只能在你的模擬器發(fā)射的任何時(shí)候的看到這些演示之一。這是作為 AutoCompleteTextView部件在 Android中提供的并將在第 8章討論。在這兩種狀態(tài)之間點(diǎn)擊復(fù)選框切換來(lái) 指示選擇(例如,“添加快遞到我的命令”)。它作為一個(gè)TextView先驅(qū),因此您可以像 Android使用 TextView性能:格式部件添加文字顏色。 例如,從 the Basic/CheckBox的項(xiàng)目,這里是一個(gè)簡(jiǎn)單的復(fù)選框的布局: ?xml version= encoding=utf8? CheckBox xmlns:android= android:id=+id/check android:layout_width=wrap_content android:layout_height=wrap_content android:text=This checkbox is: unchecked / 相應(yīng)的 checkbox的行為: public class CheckBoxDemo extends Activity implements { CheckBox cb。 setContentView()。 (this)。 } else { (This checkbox is: unchecked)?;卣{(diào)偵聽器在 onCheckedChanged(),它接收復(fù)選框的狀態(tài)有什么新的變化和狀態(tài)。 結(jié)果呢?點(diǎn)擊復(fù)選框立即更新其內(nèi)容,你可以看圖 64和 65。 像復(fù)選框, RadioButton從 CompoundButton中繼承,從而繼承了 TextView。同樣,您可以在一個(gè)單選按鈕上調(diào)用 isChecked(),看看它是否被選中,切換()來(lái)選擇它,等等,就像你可以用一個(gè)復(fù)選框。該 RadioGroup表明其狀態(tài)的單選按鈕設(shè)置聯(lián)系在一起,這意味著只有一個(gè)按鈕退出組可以在任何時(shí)間選擇。預(yù)先設(shè)定的一個(gè)單選按鈕被選中,在 RadioButton上使用 setChecked()或從您的 OnCreate()在 activity中回調(diào),在 RadioGroup上選中()。 視圖中最有可能被使用的某些屬性,包括: ? Controls the focus sequence: ? android:nextFocusDown ? android:nextFocusLeft ? android:nextFocusRight ? android:nextFocusUp ? android:visibility, which controls whether the widget is initially 第 17 頁(yè) 共 35 頁(yè) visible ? android:background, which typically provides an RGB color value (., 00FF00 for green) to serve as the background for the widget 您可以切換是否通過(guò) setEnabled()啟用了一個(gè)小裝置,看看它是否是通過(guò)isEnabled()啟用的。 你可 以通過(guò) requestFocus()給出一個(gè)部件重點(diǎn),看看它是否是通過(guò)isFocused()為重點(diǎn)。 為了幫助操縱部件樹和容器,組成一個(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 頁(yè) 共 35 頁(yè) 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 頁(yè) 共 35 頁(yè) 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 design
點(diǎn)擊復(fù)制文檔內(nèi)容
公司管理相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1