Ams1
Ams1

Reputation: 135

Icon doesn't load

Hi my icons don't load and i don't know why. They should appear in the navigation. Im very new and don't find good new resources to learn. Everything is old. Some links would help thank u.

enter image description here

enter image description here

enter image description here

Upvotes: 1

Views: 77

Answers (1)

dylansturg
dylansturg

Reputation: 1708

The GetView needs to set the image on the ImageButton in the layout. Notice that you aren't even using the items in your adapter? Instead of using a list of ImageButton why not accept the drawables, and then set the image of each ImageButton from the items? See an updated version of GetView (below) which should get you a working example of setting the image on the ImageButton in each of your buttons.

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;
 }

Upvotes: 3

Related Questions