2

I'm trying to create a tablayout with icons. I used the property setIcon but one of the icon looked a bit smaller than the rest so I decided to use custom view to display that icon. The problem is that it's a little blurred. If I use an icon with larger resolution, then the size of the icon changes to but I want to keep the size of the icon the same as the other icons.

Here's the layout for custom view:

<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_gravity="center"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/icon"
    android:layout_centerHorizontal="true" />

and here's how I set the view to the icon:

TextView tabOne = (TextView)LayoutInflater.From(this).Inflate(Resource.Layout.custom_tab, null);
tabOne.SetCompoundDrawablesWithIntrinsicBounds(0, Resource.Drawable.ic_newnotif, 0, 0);
tabLayout.GetTabAt(3).SetCustomView(tabOne);

the result is as below (second icon from the right):

enter image description here

I also need to push it down a little to align it with other icons.

If I use 'setIcon', the result is this:

enter image description here

As you can see from the image, the icon looks a bit smaller. How do I fix this?

Ahmed Mujtaba
  • 2,110
  • 5
  • 36
  • 67

1 Answers1

0

You can try our my answer although I didn't try the issue of your's as long as issue with the height this can be solved by ans from post here if this didn't work let me know I will try something other

Parth Dave
  • 2,096
  • 13
  • 20