前言
组件是 Android 程序设计的基本组成单元,通过使用组件可以高效地开发 Android 应用程序。
文本类组件
Android 中提供了一些与文本显示、输入相关的组件,通过这些组件可以显示或输入文字。
TextView 类:用于显示文本的组件为文本框组件。
EditText 类:允许用户编辑文本内容。
举例说明:编辑框
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#EAEAEA"
tools:context=".MainActivity">
<!-- 添加写说说编辑框 -->
<EditText
android:id="@+id/edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:background="#FFFFFF"
android:gravity="top"
android:hint="说点什么吧..."
android:inputType="textMultiLine"
android:lines="6"
android:padding="5dp"></EditText>
<ImageView
android:id="@+id/picture"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_below="@&#