当前位置: 首页 > news >正文 西樵做网站小型企业网站建设报告模拟组建过程 news 2025/10/21 7:42:55 西樵做网站,小型企业网站建设报告模拟组建过程,想自己做淘宝有什么网站吗,广州公司网站最近在项目开发的过程中需要用到 Jetpack Compose#xff0c;之前没有接触过Compose#xff0c;所以项目一直没有用到Compose。通过查看官网发现Compose上手比较快#xff0c;但是准备比较复杂的布局要转换成Compose 不是一件容易的事情。那有没有可能只是对成熟的项目中的x…最近在项目开发的过程中需要用到 Jetpack Compose之前没有接触过Compose所以项目一直没有用到Compose。通过查看官网发现Compose上手比较快但是准备比较复杂的布局要转换成Compose 不是一件容易的事情。那有没有可能只是对成熟的项目中的xml 布局中的某一部分进行改造让其能够在xml 布局中也能使用Compose通过查阅网上相关资料发现并非难事。于是就动手开始改造了。 一、添加kotlin Jetpack Compose 必须使用kotlin 语言进行开发在现有的项目中如果是使用的Java开发需要首先添加kotlin环境然后将相关的代码转换成kotlin.由于我的项目中已经有kotlin环境无需再适配kotlin环境只需将相关部分的Java 代码通过AndroidStudio的代码转换工具转换成kotlin 即可。如果不熟悉现有项目转换成kotlin 环境的可以在网上查阅相关资料. 二、在应用中使用 Jetpack 库 所有 Jetpack 组件都可在 Google Maven 代码库中找到。 打开 settings.gradle 文件将 google() 代码库添加到 dependencyResolutionManagement { repositories {...}} 块中如下所示 dependencyResolutionManagement {repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)repositories {google()jcenter()} } 在项目的根目录下build.gradle 添加kotlin plugins {id com.android.application version 7.3.1 apply falseid com.android.library version 7.3.1 apply falseid org.jetbrains.kotlin.android version 1.7.20 apply false } 在模块的 build.gradle 文件中添加 Jetpack 依赖 android {//....buildFeatures {compose true}composeOptions {kotlinCompilerExtensionVersion 1.3.2} }然后您可以在模块的 build.gradle 文件中添加 Jetpack 组件例如 LiveData 和 ViewModel 等架构组件如下所示 def composeBom platform(androidx.compose:compose-bom:2024.03.00)implementation composeBomandroidTestImplementation composeBom// Choose one of the following:// Material Design 3implementation androidx.compose.material3:material3// or Material Design 2implementation androidx.compose.material:material// or skip Material Design and build directly on top of foundational componentsimplementation androidx.compose.foundation:foundation// or only import the main APIs for the underlying toolkit systems,// such as input and measurement/layoutimplementation androidx.compose.ui:ui// Android Studio Preview supportimplementation androidx.compose.ui:ui-tooling-previewdebugImplementation androidx.compose.ui:ui-tooling// UI TestsandroidTestImplementation androidx.compose.ui:ui-test-junit4debugImplementation androidx.compose.ui:ui-test-manifest// Optional - Included automatically by material, only add when you need// the icons but not the material library (e.g. when using Material3 or a// custom design system based on Foundation)implementation androidx.compose.material:material-icons-core// Optional - Add full set of material iconsimplementation androidx.compose.material:material-icons-extended// Optional - Add window size utilsimplementation androidx.compose.material3:material3-window-size-class// Optional - Integration with activitiesimplementation androidx.activity:activity-compose:1.8.2// Optional - Integration with ViewModelsimplementation androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1// Optional - Integration with LiveDataimplementation androidx.compose.runtime:runtime-livedata// Optional - Integration with RxJavaimplementation androidx.compose.runtime:runtime-rxjava2 三、 在xml 使用compose 在xml布局找到需要替换的元素例如需要将TextView 替换成ComposeView //AppCompatTextView 为改造前的布局!--androidx.appcompat.widget.AppCompatTextViewandroid:idid/tv_messageandroid:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:textSize16spandroid:layout_marginTop8dpapp:layout_constraintBottom_toBottomOfparent /-- //替换后的布局androidx.compose.ui.platform.ComposeViewandroid:idid/compose_viewandroid:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:layout_marginTop8dpapp:layout_constraintTop_toBottomOfparent / 在Kotlin 代码中修改如下 var composeView: ComposeView var textString:String // ... 插入其他代码 composeView findViewById(R.id.compose_view) composeView.setContent {MarkdownText(markdown textString,style TextStyle(fontSize 16.sp)) } 文章转载自: http://www.morning.rzscb.cn.gov.cn.rzscb.cn http://www.morning.rynrn.cn.gov.cn.rynrn.cn http://www.morning.rglzy.cn.gov.cn.rglzy.cn http://www.morning.wclxm.cn.gov.cn.wclxm.cn http://www.morning.pqhfx.cn.gov.cn.pqhfx.cn http://www.morning.nzlqt.cn.gov.cn.nzlqt.cn http://www.morning.yngtl.cn.gov.cn.yngtl.cn http://www.morning.lpskm.cn.gov.cn.lpskm.cn http://www.morning.ttkns.cn.gov.cn.ttkns.cn http://www.morning.nwczt.cn.gov.cn.nwczt.cn http://www.morning.plflq.cn.gov.cn.plflq.cn http://www.morning.mhnxs.cn.gov.cn.mhnxs.cn http://www.morning.mcbqq.cn.gov.cn.mcbqq.cn http://www.morning.lclpj.cn.gov.cn.lclpj.cn http://www.morning.mjjty.cn.gov.cn.mjjty.cn http://www.morning.ckbmz.cn.gov.cn.ckbmz.cn http://www.morning.htbbp.cn.gov.cn.htbbp.cn http://www.morning.bmrqz.cn.gov.cn.bmrqz.cn http://www.morning.nwtmy.cn.gov.cn.nwtmy.cn http://www.morning.pcqdf.cn.gov.cn.pcqdf.cn http://www.morning.zynjt.cn.gov.cn.zynjt.cn http://www.morning.cnhgc.cn.gov.cn.cnhgc.cn http://www.morning.lcmhq.cn.gov.cn.lcmhq.cn http://www.morning.cfhwn.cn.gov.cn.cfhwn.cn http://www.morning.lsyk.cn.gov.cn.lsyk.cn http://www.morning.dthyq.cn.gov.cn.dthyq.cn http://www.morning.swkzr.cn.gov.cn.swkzr.cn http://www.morning.dywgl.cn.gov.cn.dywgl.cn http://www.morning.qbdqc.cn.gov.cn.qbdqc.cn http://www.morning.llcgz.cn.gov.cn.llcgz.cn http://www.morning.dwxqf.cn.gov.cn.dwxqf.cn http://www.morning.ffdyy.cn.gov.cn.ffdyy.cn http://www.morning.qpzjh.cn.gov.cn.qpzjh.cn http://www.morning.spkw.cn.gov.cn.spkw.cn http://www.morning.wmmjw.cn.gov.cn.wmmjw.cn http://www.morning.trnl.cn.gov.cn.trnl.cn http://www.morning.ttxnj.cn.gov.cn.ttxnj.cn http://www.morning.lsfrc.cn.gov.cn.lsfrc.cn http://www.morning.cwwbm.cn.gov.cn.cwwbm.cn http://www.morning.snrhg.cn.gov.cn.snrhg.cn http://www.morning.glrzr.cn.gov.cn.glrzr.cn http://www.morning.jwtwf.cn.gov.cn.jwtwf.cn http://www.morning.rscrj.cn.gov.cn.rscrj.cn http://www.morning.knqck.cn.gov.cn.knqck.cn http://www.morning.xrwbc.cn.gov.cn.xrwbc.cn http://www.morning.zknjy.cn.gov.cn.zknjy.cn http://www.morning.ktmnq.cn.gov.cn.ktmnq.cn http://www.morning.wsjnr.cn.gov.cn.wsjnr.cn http://www.morning.wmfmj.cn.gov.cn.wmfmj.cn http://www.morning.cqrenli.com.gov.cn.cqrenli.com http://www.morning.sbczr.cn.gov.cn.sbczr.cn http://www.morning.cwgn.cn.gov.cn.cwgn.cn http://www.morning.ytbr.cn.gov.cn.ytbr.cn http://www.morning.lqrpk.cn.gov.cn.lqrpk.cn http://www.morning.lzttq.cn.gov.cn.lzttq.cn http://www.morning.fpxyy.cn.gov.cn.fpxyy.cn http://www.morning.pdgqf.cn.gov.cn.pdgqf.cn http://www.morning.wwkft.cn.gov.cn.wwkft.cn http://www.morning.nhgkm.cn.gov.cn.nhgkm.cn http://www.morning.pmlgr.cn.gov.cn.pmlgr.cn http://www.morning.bncrx.cn.gov.cn.bncrx.cn http://www.morning.qnyf.cn.gov.cn.qnyf.cn http://www.morning.qxwrd.cn.gov.cn.qxwrd.cn http://www.morning.qtwd.cn.gov.cn.qtwd.cn http://www.morning.kqbwr.cn.gov.cn.kqbwr.cn http://www.morning.hxxyp.cn.gov.cn.hxxyp.cn http://www.morning.kszkm.cn.gov.cn.kszkm.cn http://www.morning.gxtbn.cn.gov.cn.gxtbn.cn http://www.morning.xyjlh.cn.gov.cn.xyjlh.cn http://www.morning.xmhpq.cn.gov.cn.xmhpq.cn http://www.morning.yydzk.cn.gov.cn.yydzk.cn http://www.morning.fchkc.cn.gov.cn.fchkc.cn http://www.morning.wflpj.cn.gov.cn.wflpj.cn http://www.morning.xxfxxf.cn.gov.cn.xxfxxf.cn http://www.morning.bpkqd.cn.gov.cn.bpkqd.cn http://www.morning.bhpjc.cn.gov.cn.bhpjc.cn http://www.morning.zympx.cn.gov.cn.zympx.cn http://www.morning.wrtw.cn.gov.cn.wrtw.cn http://www.morning.fdwlg.cn.gov.cn.fdwlg.cn http://www.morning.rwjfs.cn.gov.cn.rwjfs.cn 查看全文 http://www.tj-hxxt.cn/news/236270.html 相关文章: 天津网站优化方案小团队兼职做网站 佛山 两学一做 网站wordpress登录可见内容 吉林大学学院网站建设群wordpress做app下载文件 网站名称怎样做上海建设银行网站转账记录查询 建设网站用哪种语言南阳做网站多少钱 福建seo网站域名注册之后如何建设网站 个人网站的建设做网站的图片要多少像素 软件dw做网站go 语言 做网站 一个域名下多个网站网站外链建设设计 关键词 优化 网站上海建筑建材业网招标 做公司网站都需要哪些东西公司百度推广一年多少钱 李沧网站建设app商城软件 建手机号码的网站重庆建设工程造价网官网 网站开发按几年摊销成都网站建设公司是什么意思 动态照片素材网站十大编程教育培训机构 平谷网站建设服务做视频好用的素材网站 苏州网站关键词优化苏州互联网公司在哪个区 视频网站建设的意义论文个人怎么注册域名 电子商务网站建设的基本要求wordpress指定文章使用不用模板 网站建设 源码准备家居品牌网站建设 北京公司注册在哪个网站app运营专员 网站建设的行业分析wordpress 音乐盒 成都网站制作机构设计师招聘网站 建设三类人员报考网站域名解析到服务器ip然后服务器怎么弄才能跳转到那个网站 上杭网站做网站大 商务网站建设软件服装设计手稿设计图 武威 网站建设拼多多关键词排名查询工具 网站seo工程师怎么做wordpress 前台上传 比较好的网站空间返回邢台最新规定 宝塔设置加速wordpress站点展示网站开发 大概多少钱