HarmonyOS 类似swiper的侧滑组件,children只占小于屏幕宽度的一部分

HarmonyOS
2024-12-26 14:58:33
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
fox280

可以使用list,demo如下:

@Entry
@Component
struct SwiperPage {
  @State message: string = 'Hello World';
  build() {
    RelativeContainer() {
      List({ space: 10 }) {
        ListItem() {
          Image($r("app.media.baozhen"))
            .width('70%')
            .height(120)
            .borderRadius(8)
        }
        ListItem() {
          Image($r("app.media.sky"))
            .width('70%')
            .height(120)
            .borderRadius(8)
        }
        ListItem() {
          Image($r("app.media.xingkong"))
            .width('70%')
            .height(120)
            .borderRadius(8)
        }
      }
      .chainAnimation(true)
      .edgeEffect(EdgeEffect.Spring)
      .listDirection(Axis.Horizontal)
      .width('100%')
      .height(120)
    }
    .height('100%')
    .width('100%')
  }
}
分享
微博
QQ
微信
回复
2024-12-26 17:31:37
相关问题
自选swiper能否在屏幕中显示一部分
1559浏览 • 1回复 待解决
HarmonyOS 如何禁用屏幕返回手势
1132浏览 • 1回复 待解决
HarmonyOS RN删除组件
1009浏览 • 1回复 待解决
HarmonyOS 关于返回监听
795浏览 • 1回复 待解决
HarmonyOS 事件
805浏览 • 1回复 待解决
HarmonyOS 如何禁止系统返回
784浏览 • 1回复 待解决
HarmonyOS 怎么禁止
976浏览 • 1回复 待解决
HarmonyOS webview返回上页问题
2171浏览 • 1回复 待解决
如何禁止返回上
633浏览 • 1回复 待解决
删除功能列表有哪些?
1780浏览 • 1回复 待解决
HarmonyOS 怎么让listitem按钮失效
743浏览 • 1回复 待解决