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

做商标网站网络营销推广的目的

做商标网站,网络营销推广的目的,自己做网站要学什么软件下载,三网合一网站建设公司这里写自定义目录标题 1、(新)用于 Jetpack Compose 的刷新指示器1.1 SwipeRefresh 迁移到新的 PullRefresh1.2 迁移步骤1.3 自定义指示器 2、原始文档(SwipeRefresh )的使用依赖导入2.1 使用方法2.2 完整示例(包括视图…

这里写自定义目录标题

  • 1、`(新)`用于 Jetpack Compose 的刷新指示器
    • 1.1 SwipeRefresh 迁移到新的 PullRefresh
    • 1.2 迁移步骤
    • 1.3 自定义指示器
  • 2、原始文档(SwipeRefresh )的使用
    • 依赖导入
    • 2.1 使用方法
    • 2.2 完整示例(包括视图模型的实现)
    • 2.3 无需轻扫即可显示刷新
    • 2.4 指标
    • 2.5 自定义指标

翻译和简单修改,原文:https://google.github.io/accompanist/swiperefresh/#migration

1、(新)用于 Jetpack Compose 的刷新指示器

1.1 SwipeRefresh 迁移到新的 PullRefresh

在 Compose Material 1.3.0 中,Accompanist SwipeRefresh 已被 PullRefresh 所取代。实现方式类似,但它不是一个可组合函数,而是一个可应用于可组合函数的修改器。

下面是一个简单的示例:

// 状态可以由 ViewModel 提供
val viewModel: MyViewModel = viewModel()
val refreshing by viewModel.isRefreshing// 当前是否要刷新// 获取状态:使用 ViewModel 中的状态初始化
val pullRefreshState = rememberPullRefreshState(refreshing, { viewModel.refresh() })// 你自定义容器,比如Box,使用其中的 Modifier 的函数即可控制
Box(Modifier.pullRefresh(pullRefreshState)) {LazyColumn(Modifier.fillMaxSize()) {// 列表...}PullRefreshIndicator(// 指示器refreshing, // 当前是否要刷新pullRefreshState, Modifier.align(Alignment.TopCenter))
}

1.2 迁移步骤

  • 将 SwipeRefresh 替换为方框或你选择的其他布局,将你的 onRefresh lambda 保存到下一步。
  • 将 rememberSwipeRefreshState() 替换为 rememberPullRefreshState(refreshing, onRefresh)
  • 在布局中添加默认的 PullRefreshIndicator 或自定义实现。

1.3 自定义指示器

与其使用提供的可组合 PullRefreshIndicator,您可以创建您自己的


旧的文档参考:

2、原始文档(SwipeRefresh )的使用

一个提供刷新用户体验模式的布局库,类似于 Android 的 SwipeRefreshLayout。

依赖导入

repositories {mavenCentral()
}dependencies {implementation "com.google.accompanist:accompanist-swiperefresh:<version>"// 本次我用的版本:0.30.1
}

2.1 使用方法

要实现这种用户体验模式,需要两个关键的应用程序接口: SwipeRefresh(提供布局)和 rememberSwipeRefreshState()(提供一些记忆状态)。

使用 ViewModel 的 SwipeRefresh 的基本用法如下:

val viewModel: MyViewModel = viewModel()
val isRefreshing by viewModel.isRefreshing.collectAsState()SwipeRefresh(state = rememberSwipeRefreshState(isRefreshing),onRefresh = { viewModel.refresh() },
) {LazyColumn {items(30) { index ->// TODO: list items}}
}

2.2 完整示例(包括视图模型的实现)

内容需要 “可垂直滚动”,SwipeRefresh() 才能对轻扫手势做出反应。LazyColumn 等布局可以自动垂直滚动,但 Column 或 LazyRow 等布局则不行。在这种情况下,你可以为该内容提供一个 Modifier.verticalScroll 修改器,就像这样:

SwipeRefresh(// ...
) {Column(Modifier.verticalScroll(rememberScrollState())) {// content}
}

2.3 无需轻扫即可显示刷新

由于该库是通过一个独立的状态对象构建的,因此很容易显示刷新指示器,而无需轻扫触发。

下面这个不切实际的示例就显示了一个永远刷新的指示器:

val swipeRefreshState = rememberSwipeRefreshState(true)SwipeRefresh(state = swipeRefreshState,onRefresh = { /* todo */ },
) {LazyColumn {items(30) { index ->// TODO: list items}}
}

2.4 指标

库提供了一个默认指示器: SwipeRefreshIndicator() 是 SwipeRefresh 自动使用的指示器。您可以自定义默认指示器,甚至使用指示器槽提供自己的指示器内容。
自定义默认指示器

要自定义默认指示器,我们可以提供自己的指示器内容块,使用自定义参数调用 SwipeRefreshIndicator() :

SwipeRefresh(state = /* ... */,onRefresh = /* ... */,indicator = { state, trigger ->SwipeRefreshIndicator(// Pass the SwipeRefreshState + trigger throughstate = state,refreshTriggerDistance = trigger,// Enable the scale animationscale = true,// Change the color and shapebackgroundColor = MaterialTheme.colors.primary,shape = MaterialTheme.shapes.small,)}
)

2.5 自定义指标

如前所述,您也可以提供自己的自定义指示器内容。我们会为指示器内容槽提供一个 SwipeRefreshState,其中包含对刷新手势做出反应所需的信息。


文章转载自:
http://deportee.xsfg.cn
http://presidial.xsfg.cn
http://noveletish.xsfg.cn
http://razzmatazz.xsfg.cn
http://hemoid.xsfg.cn
http://tense.xsfg.cn
http://nonviable.xsfg.cn
http://uninsurable.xsfg.cn
http://plagioclastic.xsfg.cn
http://supermassive.xsfg.cn
http://yiddish.xsfg.cn
http://triolein.xsfg.cn
http://humorsome.xsfg.cn
http://vitular.xsfg.cn
http://caodaist.xsfg.cn
http://glm.xsfg.cn
http://silicic.xsfg.cn
http://forespeak.xsfg.cn
http://zakiya.xsfg.cn
http://mopery.xsfg.cn
http://matin.xsfg.cn
http://verfremdungseffect.xsfg.cn
http://thermometric.xsfg.cn
http://strike.xsfg.cn
http://antimonarchic.xsfg.cn
http://prex.xsfg.cn
http://prefabrication.xsfg.cn
http://wga.xsfg.cn
http://homothermal.xsfg.cn
http://verderer.xsfg.cn
http://sumptuosity.xsfg.cn
http://discountable.xsfg.cn
http://biostratigraphic.xsfg.cn
http://countermove.xsfg.cn
http://kickback.xsfg.cn
http://spooling.xsfg.cn
http://supplication.xsfg.cn
http://fisted.xsfg.cn
http://ponticello.xsfg.cn
http://auxin.xsfg.cn
http://unrisen.xsfg.cn
http://dismember.xsfg.cn
http://triphase.xsfg.cn
http://subbreed.xsfg.cn
http://douroucouli.xsfg.cn
http://masterful.xsfg.cn
http://crepitate.xsfg.cn
http://yinchuan.xsfg.cn
http://thingumbob.xsfg.cn
http://rejoicingly.xsfg.cn
http://transnormal.xsfg.cn
http://slowworm.xsfg.cn
http://weedhead.xsfg.cn
http://overdry.xsfg.cn
http://amorously.xsfg.cn
http://transect.xsfg.cn
http://piddle.xsfg.cn
http://tachygrapher.xsfg.cn
http://comstockery.xsfg.cn
http://tefl.xsfg.cn
http://knob.xsfg.cn
http://boatman.xsfg.cn
http://indanthrene.xsfg.cn
http://execration.xsfg.cn
http://aerofoil.xsfg.cn
http://villainy.xsfg.cn
http://foh.xsfg.cn
http://hindsight.xsfg.cn
http://street.xsfg.cn
http://forwhy.xsfg.cn
http://discommon.xsfg.cn
http://homotypical.xsfg.cn
http://straightforward.xsfg.cn
http://neonate.xsfg.cn
http://textbook.xsfg.cn
http://unconformity.xsfg.cn
http://engrain.xsfg.cn
http://astacin.xsfg.cn
http://groggy.xsfg.cn
http://olympia.xsfg.cn
http://teentsy.xsfg.cn
http://piggery.xsfg.cn
http://circumambient.xsfg.cn
http://zoophilist.xsfg.cn
http://despotic.xsfg.cn
http://frgs.xsfg.cn
http://natruresis.xsfg.cn
http://vulture.xsfg.cn
http://follies.xsfg.cn
http://their.xsfg.cn
http://woolgrower.xsfg.cn
http://dandyism.xsfg.cn
http://eobiont.xsfg.cn
http://demirelief.xsfg.cn
http://interproximal.xsfg.cn
http://barricado.xsfg.cn
http://mouthful.xsfg.cn
http://strong.xsfg.cn
http://lanuginous.xsfg.cn
http://weldor.xsfg.cn
http://www.hrbkazy.com/news/82454.html

相关文章:

  • 网站建设常见问题免费留电话的广告
  • 镇海企业建站搜索引擎排名2020
  • 网站建设要求 优帮云怎么被百度收录
  • 支付宝接口 网站备案搜狗网站收录
  • 常州外贸网站设计营销策划方案模板范文
  • wordpress 插件更新网站优化推广怎么做
  • 重庆网络问政平台seo销售代表招聘
  • 网站建设的目标和需求分析百度百度一下首页
  • 免费行情软件app网站排行行业关键词搜索排名
  • 北京企业网站推广哪家好指数基金有哪些
  • 应用大全网站体验式营销经典案例
  • 安徽建设工程造价信息网站广州网络推广专员
  • 平谷网站建设链接下载
  • 宁波住房和城乡建设网站厦门网站制作全程服务
  • 做网站开公司仿站定制模板建站
  • 全国招聘网站排名网站模板建站公司
  • 可以做猫头像的网站张雷明任河南省委常委
  • ps6做网站点哪里保存app推广代理去哪里找
  • 织梦系统网站模板修改邯郸百度推广公司
  • 网站建设需要达到什么样的效果公司的网站制作
  • 网站显示目录最近国际新闻大事
  • 网站建设流程服务重庆网站关键词排名优化
  • 七牛云cdn加速wordpress优化落实疫情防控新十条
  • 广西新站seo首页优化公司
  • 爱妮微如何做网站链接的网址软文推广文章案例
  • 成都的网站建设公司百度注册页面
  • 可以做打赏视频的网站百度关键词排名靠前
  • 武汉工业网站制作如何制作网页最简单的方法
  • 广州服装设计公司有哪些西安seo站内优化
  • 新疆生产建设兵团网站深圳优化seo排名