当前位置: 首页 > news >正文

android studio 创建按钮项目

1)、新建一个empty activity项目,切换到project视图:

2)、修改app\src\main\res\layout\activity_main.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"><TextViewandroid:id="@+id/textView"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="Hello everyone!"app:layout_constraintBottom_toBottomOf="parent"app:layout_constraintEnd_toEndOf="@+id/button"app:layout_constraintStart_toStartOf="@+id/button"app:layout_constraintTop_toTopOf="parent" /><Buttonandroid:id="@+id/button"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="开灯"app:layout_constraintBottom_toTopOf="@+id/textView"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="parent" /></androidx.constraintlayout.widget.ConstraintLayout>

3)、点击运行,运行效果如下:

http://www.lryc.cn/news/261920.html

相关文章:

  • gitee提交代码步骤介绍(含git环境搭建)
  • 【MyBatis-Plus】常用的插件介绍(乐观锁、逻辑删除、分页)
  • DApp测试网络Ganache本地部署并实现远程连接
  • 好用的硬盘分区工具,傲梅分区助手 V10.2
  • 【华为鸿蒙系统学习】- HarmonyOS4.0开发|自学篇
  • Qt图像处理-Qt中配置OpenCV打开本地图片
  • HTML中RGB颜色表示法和RGBA颜色表示法
  • Openwrt源码下载出现“The remote end hung up unexpected”
  • Spring定时任务动态更改(增、删、改)Cron表达式方案实例详解
  • 常用登录加密之Shiro与Spring Security的使用对比
  • 获取文件路径里的文件名(不包含扩展名)
  • HiveSql语法优化二 :join算法
  • Leetcode—459.重复的子字符串【简单】
  • Mac安装Typora实现markdown自由
  • 前后端传参格式
  • 【后端学前端】第三天 css动画 动态搜索框(定位、动态设置宽度)
  • 51.0/表单(详细版)
  • 动态规划(Dynamic Programming)
  • linux使用文件描述符0、1和2来处理输入和输出
  • how to write and run .ps1
  • 如何在PHP中处理跨域请求?
  • spring boot 配置多数据源 踩坑 BindingException: Invalid bound statement (not found)
  • 【产品】Axure的基本使用(二)
  • Python语言学习笔记之十(字符串处理)
  • WPF-附加属性《十二》
  • 算法通关第十九关-青铜挑战理解动态规划
  • 2023 GitHub年度排行榜,JEECG上榜第三名,势头依然很猛~
  • 由@EnableWebMvc注解引发的Jackson解析异常
  • ce从初阶到大牛--函数
  • Java学习异常类