app页面是html还是xml写的,HTML、XML、XHTML 有什么区别

HTML, XML, XHTML 有什么区别

先说一下三者的定义。

HTML:HyperText Markup Language / 超文本标记语言

XML: Extensible Markup Language / 可扩展标记语言

XHTML: Extensible Hypertext Markup Language / 可扩展超文本标记语

这定义说了等于没说,只知道都是标记语言。

超文本是什么?可扩展是什么?

完全没概念。

作为一个前端,最熟悉是就是 HTML 了,所以我们先从 HTML 说起。

HTML 是用来描述和定义网页内容的标记语言,是构成网页的最基本的东西。

所谓超文本,就是说它除了能标记文本,还能标记其他的内容,比如:图片,链接,音频,视频等。

它的作用就是一个规范,告诉所有浏览器都统一标准,比如我给这段文字加个

标签,那就是告诉浏览器:这是一个段落。我加个 标签:这是一张图片,别弄错了。浏览器看到后,就会正确解析,产生相应的行为。

然后说一下 XML

它的表现形式就是给一个文档加一堆标签,说明每段文字是干什么的,有什么意义。这样做的目的是方便存储、传输、分享数据,人和机器都可以很方便的阅读。XML 和 HTML 有一个明显的区别就是:HTML 的标签都是预定义的,你不可以自己随便增加,比如你不能自造一个标签叫 , 但是 XML 可以,你可以自己“发明”标签————这也是“可扩展的”一个含义。

HTML 和 XML 一结合,就产生了 XHTML

XHTML 就是以 XML 的语法形式来写 HTML.

XHTML 出现的原因是:HTML 是一种语法形式比较松散的标记语言,语法要求也不严格。比如大小可以混用,属性值随便你加不加引号,单引号还是双引号也随便你,标签也可以不闭合。HTML 标准的制定者 W3C 一看这样下去不行,所谓无规矩不成方圆,所以就把 XML 的语法形式往 HTML 上一套,出现了 XHTML,所以你也可以把 XHTML 理解为 HTML 的严格语法形式,除此之外,其它方面基本一样。

比如 XHTML 有一些强制的要求,如下:

必须包含一个文件头声明

所有元素名必须小写

所有空元素必须关闭

所有属性名必须小写

所有属性值必须加引号

所有布尔值属性必须加上属性值

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 可以参考以下XML布局:<LinearLayout 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:gravity="center_horizontal" tools:context=".MainActivity"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/logo"/> <EditText android:id="@+id/username" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="Username" android:inputType="text"/> <EditText android:id="@+id/password" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="Password" android:inputType="textPassword"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Login" /></LinearLayout> ### 回答2: 安卓APP登录页面XML布局可以使用LinearLayout来实现。以下是一个简单的例子: ```xml <LinearLayout 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" android:orientation="vertical" android:gravity="center" android:padding="16dp"> <ImageView android:id="@+id/logoImageView" android:layout_width="100dp" android:layout_height="100dp" android:src="@drawable/app_logo" android:scaleType="centerCrop" android:layout_gravity="center" /> <EditText android:id="@+id/usernameEditText" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:hint="用户名" android:inputType="text" /> <EditText android:id="@+id/passwordEditText" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="8dp" android:hint="密码" android:inputType="textPassword" /> <Button android:id="@+id/loginButton" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:text="登录" /> <TextView android:id="@+id/forgotPasswordTextView" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="8dp" android:text="忘记密码?" android:textAlignment="center" android:textColor="@android:color/white" /> </LinearLayout> ``` 在这个例子中,我们使用了一个纵向的LinearLayout来布局登录页面页面中包括一个Logo的ImageView、一个用于输入用户名的EditText、一个用于输入密码的EditText、一个登录的Button和一个忘记密码的TextView。可以根据具体需求进行样式和设计的修改。 ### 回答3: 下面是一个安卓app登录页面xml布局的示例: ```xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="@color/background_color"> <ImageView android:layout_width="wrap_content" android:layout_height="150dp" android:src="@drawable/app_logo" android:layout_gravity="center"/> <EditText android:id="@+id/username_edittext" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/username_hint" android:inputType="text" android:layout_marginTop="20dp" android:layout_marginStart="20dp" android:layout_marginEnd="20dp" android:background="@drawable/edittext_background" android:textColor="@color/text_color"/> <EditText android:id="@+id/password_edittext" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/password_hint" android:inputType="textPassword" android:layout_marginTop="10dp" android:layout_marginStart="20dp" android:layout_marginEnd="20dp" android:background="@drawable/edittext_background" android:textColor="@color/text_color"/> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/login_button" android:layout_marginTop="20dp" android:layout_marginStart="20dp" android:layout_marginEnd="20dp" android:background="@drawable/button_background" android:textColor="@color/button_text_color"/> <TextView android:id="@+id/forgot_password_textview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/forgot_password" android:layout_marginTop="10dp" android:layout_marginStart="20dp" android:layout_marginEnd="20dp" android:textColor="@color/text_color" android:gravity="center"/> </LinearLayout> ``` 这个布局包含一个垂直方向的线性布局,包含一个应用程序的logo图像、用户名输入框、密码输入框、登录按钮和“忘记密码”的文本视图。用户名输入框和密码输入框具有自定义的背景样式。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值