图标加载不出来
Icon doesn't load
嗨,我的图标无法加载,我不知道为什么。它们应该出现在导航中。我很新,找不到好的新资源来学习。
一切都是旧的。一些链接会有所帮助谢谢你。
GetView
需要在版面ImageButton
上设置图片。请注意,您甚至没有在适配器中使用 items
?而不是使用 ImageButton
的列表,为什么不接受可绘制对象,然后从项目中设置每个 ImageButton
的图像?请参阅 GetView
的更新版本(下方),它应该为您提供一个在每个按钮的 ImageButton
上设置图像的工作示例。
public override View GetView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if(v == null){
v = LayoutInflater.From(context).Inflate(Resource.Layout.MenuButtonLayout, parent, false);
}
var imageButton = v.FindViewById<ImageButton>(Resource.Id.myButton);
imageButton.SetImageResource(Resource.Drawable.Noten);
return v;
}
嗨,我的图标无法加载,我不知道为什么。它们应该出现在导航中。我很新,找不到好的新资源来学习。 一切都是旧的。一些链接会有所帮助谢谢你。
GetView
需要在版面ImageButton
上设置图片。请注意,您甚至没有在适配器中使用 items
?而不是使用 ImageButton
的列表,为什么不接受可绘制对象,然后从项目中设置每个 ImageButton
的图像?请参阅 GetView
的更新版本(下方),它应该为您提供一个在每个按钮的 ImageButton
上设置图像的工作示例。
public override View GetView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if(v == null){
v = LayoutInflater.From(context).Inflate(Resource.Layout.MenuButtonLayout, parent, false);
}
var imageButton = v.FindViewById<ImageButton>(Resource.Id.myButton);
imageButton.SetImageResource(Resource.Drawable.Noten);
return v;
}