![](/img/trans.png)
[英]How to align a widget at bottom_vertical | center_horizontal with RelativeLayout
[英]How to align a text to center bottom of a IconButton widget?
我想將文本與 IconButton 的中心底部對齊,但它不在中心,而是在開始時。
我想要的例子:圖片在這里
它顯示的東西:圖片在這里
編碼
Column(
children: [
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
IconButton(
onPressed: () {},
icon: Icon(
Icons.library_add_check,
size: 22,
)),
IconButton(
onPressed: () {},
icon: Icon(
Icons.message,
size: 22,
)),
IconButton(
onPressed: () {},
icon: Icon(
Icons.thumb_up,
size: 22,
)),
IconButton(
onPressed: () {},
icon: Icon(
Icons.supervisor_account,
size: 22,
)),
],
),
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Align(
alignment: Alignment.center,
child: Text(
"All",
)),
],
),
],
),
我已經嘗試了我所知道的一切,但它仍然不起作用。 非常感謝您能幫我解決這個問題。
而不是為您的IconButton()
text
創建另一行,而是使用Column()
包裝IconButton()
並將Text()
添加到該Column()
。
你可以做這樣的事情。
Column(
children: [
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceEvenly,
children: [
Column(
children:[
IconButton(
onPressed: () {},
icon: Icon(
Icons.library_add_check,
size: 22,
)),
Text("abc"),
],
),
Column(
children:[
IconButton(
onPressed: () {},
icon: Icon(
Icons.thumb_up,
size: 22,
)),
Text("abc"),
],
),
Column(
children:[
IconButton(
onPressed: () {},
icon: Icon(
Icons.message,
size: 22,
)),
Text("abc"),
],
),
Column(
children:[
IconButton(
onPressed: () {},
icon: Icon(
Icons.supervisor_account,
size: 22,
)),
Text("ABC"),
],
),
],
),
],
);
你可以在這里試試
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.