Botframework 如何在自适应卡中设置列宽以使其均匀
我试图询问自适应卡中的用户信息。但是由于卡片看起来很笨拙,所以列的大小是不同的。如何使每个列集列之间的间距均匀,使其看起来更美观。我尝试使用宽度作为Botframework 如何在自适应卡中设置列宽以使其均匀,botframework,adaptive-cards,Botframework,Adaptive Cards,我试图询问自适应卡中的用户信息。但是由于卡片看起来很笨拙,所以列的大小是不同的。如何使每个列集列之间的间距均匀,使其看起来更美观。我尝试使用宽度作为“Auto”和“Stretch”我甚至尝试使用“50px”和“100px”设置宽度,但我没有实现 请在这方面帮助我 编辑1:添加代码 我正在用C# 这是我的密码 AdaptiveCard card = new AdaptiveCard() { Body = new List<AdaptiveElement>()
“Auto”
和“Stretch”
我甚至尝试使用“50px
”和“100px”
设置宽度,但我没有实现
请在这方面帮助我
编辑1:添加代码
我正在用C#这是我的密码
AdaptiveCard card = new AdaptiveCard()
{
Body = new List<AdaptiveElement>()
{
new AdaptiveColumnSet()
{
Columns = new List<AdaptiveColumn>
{
new AdaptiveColumn()
{
Items = new List<AdaptiveElement>()
{
new AdaptiveTextBlock()
{
Text="*First Name",
Weight = AdaptiveTextWeight.Bolder
},
} ,
Width = AdaptiveColumnWidth.Auto
},
new AdaptiveColumn()
{
Width = AdaptiveColumnWidth.Auto,
Separator = true,
Items=new List<AdaptiveElement>()
{
new AdaptiveTextInput()
{
Id = "FirstName",
MaxLength = 300,
Style = AdaptiveTextInputStyle.Text,
},
}
}
}
}, // First Name
new AdaptiveColumnSet()
{
Columns = new List<AdaptiveColumn>
{
new AdaptiveColumn()
{
Items = new List<AdaptiveElement>()
{
new AdaptiveTextBlock()
{
Text="Middle Name",
Weight = AdaptiveTextWeight.Bolder
},
}
},
new AdaptiveColumn()
{
Width = "stretch",
Separator = true,
Items=new List<AdaptiveElement>()
{
new AdaptiveTextInput()
{
Id = "MiddleName",
MaxLength = 300,
Style = AdaptiveTextInputStyle.Text,
},
}
}
}
},
new AdaptiveColumnSet()
{
Columns = new List<AdaptiveColumn>
{
new AdaptiveColumn()
{
Items = new List<AdaptiveElement>()
{
new AdaptiveTextBlock()
{
Text="*Last Name",
Weight = AdaptiveTextWeight.Bolder
},
}
},
new AdaptiveColumn()
{
Width = "stretch",
Separator = true,
Items=new List<AdaptiveElement>()
{
new AdaptiveTextInput()
{
Id = "LastName",
MaxLength = 300,
Style = AdaptiveTextInputStyle.Text,
},
}
}
}
},
new AdaptiveColumnSet()
{
Columns = new List<AdaptiveColumn>
{
new AdaptiveColumn()
{
Items = new List<AdaptiveElement>()
{
new AdaptiveTextBlock()
{
Text="*Date Of Birth",
Weight = AdaptiveTextWeight.Bolder
},
}
},
new AdaptiveColumn()
{
Width = "stretch",
Separator = true,
Items=new List<AdaptiveElement>()
{
new AdaptiveDateInput()
{
Id = "DoB",
},
}
}
}
}, // Date Of Birth
}
};
AdaptiveCard卡=新的AdaptiveCard()
{
Body=新列表()
{
新的AdaptiveColumnSet()
{
列=新列表
{
新的AdaptiveColumn()
{
Items=新列表()
{
新的AdaptiveTextBlock()
{
Text=“*名字”,
权重=自适应文本权重。加粗
},
} ,
宽度=自适应列宽度。自动
},
新的AdaptiveColumn()
{
宽度=AdaptiveColumnWidth.Auto,
分隔符=真,
Items=新列表()
{
新的自适应输出()
{
Id=“FirstName”,
最大长度=300,
Style=adaptivetPutStyle.Text,
},
}
}
}
},//名字
新的AdaptiveColumnSet()
{
列=新列表
{
新的AdaptiveColumn()
{
Items=新列表()
{
新的AdaptiveTextBlock()
{
Text=“中间名”,
权重=自适应文本权重。加粗
},
}
},
新的AdaptiveColumn()
{
Width=“拉伸”,
分隔符=真,
Items=新列表()
{
新的自适应输出()
{
Id=“MiddleName”,
最大长度=300,
Style=adaptivetPutStyle.Text,
},
}
}
}
},
新的AdaptiveColumnSet()
{
列=新列表
{
新的AdaptiveColumn()
{
Items=新列表()
{
新的AdaptiveTextBlock()
{
Text=“*姓氏”,
权重=自适应文本权重。加粗
},
}
},
新的AdaptiveColumn()
{
Width=“拉伸”,
分隔符=真,
Items=新列表()
{
新的自适应输出()
{
Id=“LastName”,
最大长度=300,
Style=adaptivetPutStyle.Text,
},
}
}
}
},
新的AdaptiveColumnSet()
{
列=新列表
{
新的AdaptiveColumn()
{
Items=新列表()
{
新的AdaptiveTextBlock()
{
Text=“*出生日期”,
权重=自适应文本权重。加粗
},
}
},
新的AdaptiveColumn()
{
Width=“拉伸”,
分隔符=真,
Items=新列表()
{
新的AdaptiveDateInput()
{
Id=“DoB”,
},
}
}
}
},//出生日期
}
};
首先,如果您了解模板,您可以更轻松地控制卡
用这样的代码创建卡片已经很不推荐了,您仍然可以使用它,但是直接使用json和模板更方便
要回答您的问题,可以设置像素、拉伸、自动或加权列的宽度。与此示例类似:
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": 25,
"horizontalAlignment": "Center",
"verticalContentAlignment": "Center"
},
{
"type": "Column",
"width": "stretch"
}
]
必须将示例中的所有标签列设置为相同的大小。最简单的方法是将它们设置为固定宽度或权重
如果这不起作用,请确保术语使用正确,当权重必须为整数时,必须使用小写的“拉伸”和“宽度”,您可以在设计器中尝试此操作。自适应卡本身并不真正关心“拉伸”或“拉伸”,但例如webchat在这方面存在一些问题,卡v也是如此