Android UI 基础知识

01Android UI

1.1UI
  • 用户界面(User Interface,简称 UI,亦称使用者界面)是系统和用户之间进行交互和信息交换
    的媒介,它实现信息的内部形式与人类可以接受形式之间的转换。
  • 软件设计可分为两个部分:编码设计与UI设计。
1.2 Android UI
  • Android应用界面包含用户可查看并与之交互的所有内容。Android 提供丰富多样的预置 UI 组
    件,例如结构化布局对象和 UI 控件,您可以利用这些组件为您的应用构建图形界面。Android 还
    提供其他界面模块,用于构建特殊界面,例如对话框、通知和菜单。
  • Android UI 都是由布局和控件组成的

02 布局

布局(layout)可定义应用中的界面结构(例如 Activity 的界面结构)。布局中的所有元素均使用 View
和 ViewGroup 对象的层次结构进行构建。View 通常绘制用户可查看并进行交互的内容。然而,
ViewGroup 是不可见容器,用于定义 View 和其他 ViewGroup 对象的布局结构。

布局的结构
  • 定义界面布局的视图层次结构图示
    在这里插入图片描述
  • View 对象通常称为“微件”,可以是众多子类之一,例如 ButtonTextView
  • ViewGroup 对象通常称为“布局”,可以是提供其他布局结构的众多类型之一,例如
    LinearLayoutConstraintLayout
2.2 声明布局
  • 在 XML 中声明界面元素,Android 提供对应 View 类及其子类的简明 XML 词汇,如用于微件和布
    局的词汇。

    您也可使用 Android Studio 的 Layout Editor,并采用拖放界面来构建 XML 布局

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
	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"
	tools:context=".MainActivity">
<TextView
	android:layout_width="wrap_content"
	android:layout_height="wrap_content"
	android:text="Hello World!"
	app:layout_constraintBottom_toBottomOf="parent"
	app:layout_constraintLeft_toLeftOf="parent"
	app:layout_constraintRight_toRightOf="parent"
	app:layout_constraintTop_toTopOf="parent" />
</
  • 2
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值