【发布时间】:2020-06-01 06:11:42
【问题描述】:
我正在尝试在自适应卡中询问用户信息。但是列大小不同,因此卡片看起来很笨拙。我怎样才能使它看起来很好,每个列集列之间的间隙均匀。我尝试将宽度用作 "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
}
};
【问题讨论】:
-
你是用Json还是C#来设计自适应卡片?分享您的代码
-
这是哪个频道的? Facebook、Slack、网络聊天,还有其他什么?
-
用于网络聊天
-
AdaptiveColumn 类是否有 Size 属性?
-
@StephenOberauer 自适应列没有大小。如果要调整列的大小,可以使用
width和minHeight
标签: botframework adaptive-cards