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

xuzhou网站制作襄阳百度开户

xuzhou网站制作,襄阳百度开户,如何制作网页网站,做网站最便宜多少钱【HarmonyOS NEXT】实现截图功能 【需求】 实现:实现点击截图按钮,实现对页面/组件的截图 【步骤】 编写页面UI Entry Component struct Screenshot {BuildergetSnapContent() {Column() {Image().width(100%).objectFit(ImageFit.Auto).borderRadi…

【HarmonyOS NEXT】实现截图功能

【需求】

实现:实现点击截图按钮,实现对页面/组件的截图

【步骤】

  1. 编写页面UI
@Entry
@Component
struct Screenshot {@BuildergetSnapContent() {Column() {Image('').width('100%').objectFit(ImageFit.Auto).borderRadius(6)}.padding('10%').width('100%').height('100%').justifyContent(FlexAlign.Center).backgroundColor('rgba(0,0,0,0.5)').onClick(() => {})}@BuildergetIconUI() {Image($r('app.media.ic_snapshot')).width(20).aspectRatio(1).fillColor(Color.Black).margin({ right: 10 }).onClick(async () => {})}build() {Column({ space: 5 }) {Row() {Text('Hello Snapshot').fontSize(24)this.getIconUI()}.justifyContent(FlexAlign.SpaceBetween).padding(20).width('100%')Image('https://img20.360buyimg.com/img/jfs/t1/241153/31/4968/64736/65e53e56Fd3868b6e/b595d41ca8447ea4.jpg').width('60%').border({ width: 1, color: Color.Red }).borderRadius(8)Text('我是内容1')Text('我是内容2')Text('我是内容3')}.height('100%').width('100%').padding({ top: 50 }).backgroundColor(Color.White)}
}
  1. 导包
import { image } from '@kit.ImageKit';
import { componentSnapshot } from '@kit.ArkUI';
  1. 给需要快照的组件设置id
Column(){}.id('page')
  1. 点击调api实现截图效果
Image($r('app.media.ic_snapshot')).onClick(async () => {this.snapshotImage = await componentSnapshot.get('page')this.showSnap = !this.showSnap // 显示截屏// Todo: 截屏音效// Todo: 保存到相册})

【完整代码】

import { image } from '@kit.ImageKit';
import { componentSnapshot } from '@kit.ArkUI';@Entry
@Component
struct Screenshot {@State snapshotImage: image.PixelMap | null = null@State showSnap: boolean = false@BuildergetSnapContent() {Column() {Image(this.snapshotImage).width('100%').objectFit(ImageFit.Auto).borderRadius(6)}.padding('10%').width('100%').height('100%').justifyContent(FlexAlign.Center).backgroundColor('rgba(0,0,0,0.5)').onClick(() => {this.showSnap = false})}@BuildergetIconUI() {Image($r('app.media.ic_snapshot')).width(20).aspectRatio(1).fillColor(Color.Black).margin({ right: 10 }).onClick(async () => {this.snapshotImage = await componentSnapshot.get('page')this.showSnap = !this.showSnap // 显示截屏// Todo: 截屏音效// Todo: 保存到相册})}build() {Column({ space: 5 }) {Row() {Text('Hello Snapshot').fontSize(24)this.getIconUI()}.justifyContent(FlexAlign.SpaceBetween).padding(20).width('100%')Image('https://img20.360buyimg.com/img/jfs/t1/241153/31/4968/64736/65e53e56Fd3868b6e/b595d41ca8447ea4.jpg').width('60%').border({ width: 1, color: Color.Red }).borderRadius(8)Text('我是内容1')Text('我是内容2')Text('我是内容3')}.height('100%').width('100%').padding({ top: 50 }).backgroundColor(Color.White).id('page').bindContentCover($$this.showSnap, this.getSnapContent(), {modalTransition: ModalTransition.NONE})}
}

【效果图】

http://www.shuangfujiaoyu.com/news/36506.html

相关文章:

  • 网站代码怎么做seo 页面
  • 网站建站要求的磁力搜索引擎
  • 什么行业必须做网站沈阳网站关键词优化多少钱
  • 做网站写代码好还是模板广东网站seo策划
  • 做包装一般看什么网站360站长平台
  • 商业网站建设案例课程视屏下载苏州网站建设制作公司
  • 美国网站服务器app下载注册量推广平台
  • 泉州网站开发企业关键词推广价格
  • 在那里做网站百度安装app
  • 网页游戏网站开发产品seo标题是什么
  • 深圳市龙岗区做网站的公司网络营销的方式与手段
  • 开封做网站免费发布推广信息的软件
  • 株洲网站建设的企业chatgpt 网站
  • 如何上传视频到公司网站网络推广营销网
  • 做甜品网站栏目seo网站诊断流程
  • 厦门中国建设银行招聘信息网站seminar
  • 杭州网站开发公司排名seo快速排名培训
  • ie浏览器打开建设银行网站拉新人拿奖励的app
  • 泰国做网站互联网金融
  • 做企业网站流程seo服务外包
  • 民权做网站的公司电商网
  • 赚钱小程序东莞网络优化公司
  • 北京国贸网站建设公司找资源最好的是哪个软件
  • 深圳ui设计培训seo和sem的区别是什么?
  • 做网站seo整站优化报价
  • 新乡市红旗区建设局网站推广策划书模板范文
  • 先做公众号在做网站天猫seo搜索优化
  • 张家界网站建设方案电商引流推广方法
  • 个人网站如何做淘客网站常用的搜索引擎有哪些?
  • 制作小程序官网网站搭建谷歌seo