This content originally appeared on DEV Community and was authored by wei chang
The development of the Cangjie language mall project is basically completed. Today, I’d like to share a new project with you all, a bank app. Although it’s called a new project, you might find it somewhat familiar. This project was written about in the ArkTS tutorial. Today, let’s write the Cangjie language again to see what the differences are from ArkTS.
First of all, we can see that the page content fills the screen, so the immersive mode needs to be set. The specific code is as follows:
windowStage.getMainWindow().setWindowLayoutFullScreen(true)
Next comes the page content section. This is a scrollable List layout, so the List container can be used. Then, the list container can be further divided into several modules:
With a clear idea in mind, we can then tackle each part one by one. The asset section at the top has a background image, so we can look at the image and content sections separately. Each part becomes very simple. The specific code is as follows:
Stack(){
Image(@r(app.media.nav_img))
.width(100.percent)
Row(){
Column(6){
Row(){
Text('总资产')
.fontSize(13)
.fontColor(Color.BLACK)
Image(@r(app.media.eyes))
.width(14)
.height(10)
.margin(left:5)
}
Text('****')
.fontSize(30)
.fontColor(Color.BLACK)
.fontWeight(FontWeight.Bold)
Text('今日收益 +13.3')
.fontSize(12)
.fontColor(Color.GRAY)
}
.alignItems(HorizontalAlign.Start)
.margin(left:26)
Row(){
Image(@r(app.media.shield))
.width(16)
.height(16)
Text('开启保障')
.fontColor(Color.WHITE)
.fontSize(13)
.margin(left:6)
}
.width(102)
.height(30)
.justifyContent(FlexAlign.Center)
.backgroundColor(Color(0, 0, 0, alpha: 0.1))
.borderRadius(topLeft:15.vp,bottomLeft:15.vp)
}
.width(100.percent)
.justifyContent(FlexAlign.SpaceBetween)
}
Next comes the list of function buttons. What needs to be noted in this part is that it has some overlap with the asset content above. My implementation method is to set the margin to be negative to offset it towards the top, and then its fillets are only the top two corners. Therefore, attention should also be paid to the setting of some fillets. The reference code is as follows:
Row(){
}
.width(100.percent)
.backgroundColor(Color.WHITE)
.borderRadius(topLeft:20.vp,topRight:20.vp)
.margin(top:-40)
.padding(left:12,right:12)
In fact, you can see that most of the code is quite similar to ArkTS. Now, let’s go directly to the popular recommendations section at the very bottom. This part has a title. The best way to implement it is to use headers. As mentioned before, the header writing method of Cangjie is a bit different. Let’s take a look at the code:
@Builder func itemHead(title:String,subTitle:String){
Row(5){
Text(title)
.fontColor(Color.BLACK)
.fontSize(18)
.fontWeight(FontWeight.Bold)
Text(subTitle)
.fontColor(13)
.fontColor(0x999999)
}
.height(60)
.width(100.percent)
.padding(left:12,bottom:13)
.alignItems(VerticalAlign.Bottom)
}
ListItemGroup(ListItemGroupParams(header:{=>bind(this.itemHead,this)('热门推荐','每天告诉大家值得买的')})){
}
The above is the relevant content of the bank App case. Thank you for reading.
This content originally appeared on DEV Community and was authored by wei chang

wei chang | Sciencx (2025-06-26T01:06:45+00:00) Practical Case of HarmonyOS NEXT Cangjie Development Language: Bank App. Retrieved from https://www.scien.cx/2025/06/26/practical-case-of-harmonyos-next-cangjie-development-language-bank-app/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.