Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲

Android 開發實戰:(十)基本控件 — 10.1 TextView

編輯:關於 Android 程式設計

當你新建一個 Android 項目時,Eclipse 通常會自動生成一個 main.xml,並在其中放入一個 <TextView> 元素:

[html]
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="https://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />
</LinearLayout>

TextView 的作用很單純,就是用來向用戶展示文字資訊。作為最基礎的控件之一,幾乎在每一款 Android 應用中你都會用到它。如果希望用戶能夠編輯、修改其中的文字,那麼可以改用它的子類——EditText,它天生就是為「可輸入」場景而設計的。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © Android教程網 All Rights Reserved