欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 财经 > 产业 > flutter 类似Android 中RelativeLayout在末尾居中

flutter 类似Android 中RelativeLayout在末尾居中

2025/2/13 17:09:30 来源:https://blog.csdn.net/Goals1989/article/details/141730421  浏览:    关键词:flutter 类似Android 中RelativeLayout在末尾居中

1,Android RelativeLayout中写法:

 <RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"><Buttonandroid:id="@+id/myButton"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="点击我"android:layout_centerVertical="true"  <!-- 垂直居中 -->android:layout_alignParentEnd="true"  <!-- 末尾对齐 -->/>  </RelativeLayout>

2,flutter中末尾,垂直居中

Stack(children:[Container1(....),Container2(....),....,Positioned(right: 22.w,//尾部对齐,需要设置一个数,或者为0也行,设置了才会往那边靠top: 0,bottom: 0,//上下间距都要写,不然默认对其上边child: Align(alignment: Alignment.center,child: widget.needShowState &&(answerState != AnswerState.unanswered)? Image.asset(width: 36.w,height: 36.h,'assets/images/chinese/age_level/feilian/${getStr()}.png',fit: BoxFit.cover,): Container(),)),])

两种语言的差异还是挺大的,使用不久是会发现有点别扭,慢慢会习惯和了解的。

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com