我有一个需求列表,每个需求都具有我从json中提取的属性,目前我认为我只对来自JSON的typeName和requisiteStatusId属性感兴趣。这两个是与该需求类型(考试,阅读文章等)相对应的图像的属性及其当前状态。如何在我的列表视图中显示图片?
我已经可以显示列表视图中的图像,但我必须证明对应的typeName和requisiteStatusId的图像,例如
{
"id": 1221,
"name": "Visibility - Public Acknowledgement",
"description": "Acknowledgement from Omar during a Q Meeting",
"typeId": 11,
**"typeName": "Proven XP",**
"validationId": null,
"skillId": 131,
"skillName": "Visibility",
"material": "No Material",
"materialUrl": "#",
**"requisiteStatusId": 4,**
"trailName": "General Knowledge",
"trailId": 5,
"levelId": 1
},
这两个,你必须显示相应的图像相关,有三种状态和10种类型,现在我直接显示这样的图像,例如:
public class CustomVeggieCell : ViewCell
{
public CustomVeggieCell()
{
var image = new Image
{
};
var image2 = new Image
{
};
var nameLabel = new Label
{
VerticalTextAlignment = TextAlignment.Center,
TextColor = Color.FromHex("#FF9E9E9E"),
};
var horizontalLayout = new StackLayout()
{
};
//set bindings
nameLabel.SetBinding(Label.TextProperty, "Name", BindingMode.TwoWay);
image.Source = "book.png";
image2.Source = "Palomitashida.png";
//Set properties for desired design
horizontalLayout.Orientation = StackOrientation.Horizontal;
image2.HorizontalOptions = LayoutOptions.EndAndExpand;
nameLabel.HorizontalOptions = LayoutOptions.StartAndExpand;
nameLabel.VerticalOptions = LayoutOptions.Center;
nameLabel.TextColor = Color.FromHex("#FF9E9E9E");
//add views to the view hierarchy
horizontalLayout.Children.Add(image);
horizontalLayout.Children.Add(nameLabel);
horizontalLayout.Children.Add(image2);
View = horizontalLayout;
}
}
我不知道如何从JSON中提取的属性或如何验证它使使用id来提取JSON的告诉我是什么类型和状态的要求,我离开他们的图像,以便它可以从从的NuGet可here在上下文中 enter image description here
所以你想从JSON或ListView.SmallImageList和LargeImageList中提取值? –
@MohitShrivastava我想提取,“typeName”和“requisiteStatusId”,因为我需要显示图像,根据属性,以及现在我需要知道如何显示图像依赖于json –