立即注册

QQ登录

只需一步,快速开始

老冷编程学院

老冷培训班汇总介绍老冷付费工具汇总介绍老鬼UI编程学院EasyClick所有产品简介EasyClick官方交流群
IOS授权价格IOS/安卓 自助提卡链接安卓-中控群控-电脑授权-购买IOSusb版投屏群控教程IOS脱机版激活教程
IOS脱机版wifi局域网脚本中控教程IOS脱机版wifi局域网群控投屏教程远程调试frp,兼容安卓/IOS热更新工具,兼容安卓/IOS脱机版老冷网盘
查看: 935|回复: 3

[教程] 【EasyClick】【安卓UI】XML 基础教程~XML扫盲

[复制链接] |主动推送

43

主题

18

回帖

3104

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
3104
最后登录
2024-3-27
在线时间
427 小时

QQ认证

QQ
发表于 2023-3-15 16:49:29 | 显示全部楼层 |阅读模式

马上注册,解锁更多高级玩法

您需要 登录 才可以下载或查看,没有账号?立即注册

x
XML 基础教程(XML扫盲)
原教程地址:原生UI 扫盲篇


XML 文件说明
XML 指可扩展标记语言(eXtensible Markup Language)。
资料:xml菜鸟教程
例子
[XML] 纯文本查看 复制代码
<?xml version="1.0" encoding="utf-8"?>
<!-- 标签头-->
<a>
    <!-- 子标签头 -->
    <b>
        <c>
        </c>
    </b>
    
    <!-- 子标签尾 -->
    
    <!-- 子标签头-->
    <b1>
        <!-- 子标签头-->
        <c>
        </c>
        <!-- 子标签尾-->
    </b1>
    <!-- 子标签尾-->
    <!-- 自闭合标签 -->
    <d />
</a>
<!-- 标签尾-- >

EasyClick 标准格式

[XML] 纯文本查看 复制代码
<?xml version="1.0" encoding="UTF-8" ?>  <!-- 第一行声明是个xml 文件 编码UTF-8 -->

<ScrollView
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xsi:noNamespaceSchemaLocation="layout.xsd"
    android:layout_height="match_parent"
    android:layout_width="match_parent" >
    <LinearLayout
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:orientation="vertical"
        android:padding="20dp"  >
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="表单开始,设置tag属性,用于在代码里面获取对应的值"/>


        <LinearLayout android:layout_height="wrap_content"
                      android:orientation="horizontal"
                      android:layout_width="match_parent">
            <TextView android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="姓名: "/>

            <EditText android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:tag="name"
                      android:hint="请输入姓名"/>

        </LinearLayout>

        <LinearLayout android:layout_height="wrap_content"
                      android:orientation="horizontal"
                      android:layout_width="match_parent">
            <TextView android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="年龄: "/>

            <EditText android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:tag="age"
                      android:hint="请输入年龄"/>

        </LinearLayout>


        <LinearLayout android:layout_height="wrap_content"
                      android:orientation="horizontal"
                      android:layout_width="match_parent">
            <TextView android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="性别: "/>

            <Spinner android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:tag="sex"
                     android:text="男同学|女同学"/>

        </LinearLayout>


        <LinearLayout android:layout_height="wrap_content"
                      android:orientation="horizontal"
                      android:layout_width="match_parent">
            <TextView android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="喜欢玩"/>

            <EditText android:layout_width="100dp"
                      android:layout_height="wrap_content"
                      android:gravity="center_horizontal"
                      android:tag="a1"
                      android:hint="什么"/>
            <TextView android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="和"/>
            <EditText android:layout_width="100dp"
                      android:gravity="center_horizontal"
                      android:layout_height="wrap_content"
                      android:tag="a2"
                      android:hint="什么"/>
        </LinearLayout>


        <LinearLayout android:layout_height="wrap_content"
                      android:orientation="horizontal"
                      android:layout_width="match_parent">
            <TextView android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_gravity="center"
                      android:text="爱        好: "/>
            <LinearLayout android:layout_height="wrap_content"
                          android:orientation="vertical"
                          android:layout_width="match_parent">
                <CheckBox android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:tag="music"
                          android:text="听音乐"/>
                <CheckBox android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:tag="sing"
                          android:text="唱歌"/>
                <CheckBox android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:tag="dance"
                          android:text="跳舞"/>
            </LinearLayout>

        </LinearLayout>


        <LinearLayout android:layout_height="wrap_content"
                      android:orientation="horizontal"
                      android:layout_width="match_parent">
            <TextView android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_gravity="center"
                      android:text="所在年级: "/>
            <RadioGroup android:layout_height="wrap_content"
                        android:orientation="vertical"
                        android:layout_width="match_parent">
                <RadioButton android:layout_width="match_parent"
                             android:layout_height="wrap_content"
                             android:tag="one"
                             android:text="一年级"/>
                <RadioButton android:layout_width="match_parent"
                             android:layout_height="wrap_content"
                             android:tag="two"
                             android:text="二年级"/>
                <RadioButton android:layout_width="match_parent"
                             android:layout_height="wrap_content"
                             android:tag="three"
                             android:text="三年级"/>
            </RadioGroup>

        </LinearLayout>
        <LinearLayout android:layout_height="wrap_content"
                      android:orientation="horizontal"
                      android:gravity="center_vertical"
                      android:layout_width="match_parent">
            <TextView android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:gravity="center_vertical"
                      android:text="备注: "/>

            <EditText android:layout_width="match_parent"
                      android:layout_height="200dp"
                      android:tag="mark"
                      android:minHeight="100dp"
                      android:maxLines="1000"
                      android:hint="备注"/>

        </LinearLayout>
    </LinearLayout>
</ScrollView>


EasyClick 官方标准解释
第一行是必须有的。否则Android无法解析布局文件
这表示是一个xml 格式的文件 编码UTF-8 。
[XML] 纯文本查看 复制代码
<!-- 第一行声明是个xml 文件 编码UTF-8 -->
<?xml version="1.0" encoding="UTF-8" ?>  
Copy


第二行的标签
形如下面的xml代码
[XML] 纯文本查看 复制代码
<ScrollView
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:android="http://schemas.android.com/apk/res/android"
        xsi:noNamespaceSchemaLocation="layout.xsd"
        android:layout_height="match_parent"
        android:layout_width="match_parent" >
    <!-- 这里面写子布局-->
    <LinearLayout
                android:layout_height="match_parent"
                android:layout_width="match_parent"
                android:orientation="vertical"
                android:padding="20dp"  >
                <!-- 这里面写子布局或者 子控件-->
    </LinearLayout>
</ScrollView>



标准格式说明:


游客,如果您要查看本帖隐藏内容请回复

【老鬼教程】https://www.laoguicom.top/doc/2/
ROM定制、UI培训、UI定制

0

主题

5

回帖

54

积分

小白

Rank: 2

积分
54
最后登录
2024-3-27
在线时间
6 小时
发表于 2023-3-22 11:59:28 | 显示全部楼层
看看               

0

主题

2

回帖

32

积分

萌新

Rank: 1

积分
32
最后登录
2023-10-14
在线时间
0 小时
发表于 2023-10-12 15:35:20 | 显示全部楼层
快快快速速速速速速所所所所所所所所所所所速速所所所所

0

主题

3

回帖

31

积分

萌新

Rank: 1

积分
31
最后登录
2024-1-5
在线时间
0 小时
发表于 2024-1-5 22:11:53 | 显示全部楼层
1111111111111111111111111
游客
回复
您需要登录后才可以回帖 登录 | 立即注册

关闭

想要力量吗骚年 上一条 /2 下一条

关闭

免责声明|Archiver|手机版|闽ICP备20013040号-2| 老冷编程学院 |网站地图

GMT+8, 2024-3-28 23:35

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表