how to remove the animation of the android ?

mc 5,426 Reputation points
2021-04-21T03:25:10.253+00:00

89730-qq%E6%88%AA%E5%9B%BE20210421112258.png

after tap the menu there will be a animation like weaves how to remove it? in xamarin.android

and the active font size will be larger than that is not active how to make the two menu font size equal?

and how to remove the title name 我的 If I long-time tap the menu?

Developer technologies .NET Xamarin
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. JessieZhang-MSFT 7,716 Reputation points Microsoft External Staff
    2021-04-21T07:25:48.237+00:00

    Hello,

    Welcome to our Microsoft Q&A platform!

    the active font size will be larger than that is not active how to make the two menu font size equal?

    You can use Shell custom renderers to change tab bar text size and change icon.

    Please refer to the following code:

    1.In android, create MyShellRenderer

    [assembly: ExportRenderer(typeof(AppShell), typeof(MyShellRenderer))]  
    namespace shellicon.Droid  
    {  
    public class MyShellRenderer : ShellRenderer  
    {  
        public MyShellRenderer(Context context) : base(context)  
        {  
        }  
    
        protected override IShellBottomNavViewAppearanceTracker CreateBottomNavViewAppearanceTracker(ShellItem shellItem)  
        {  
            return new CustomBottomNavAppearance();  
        }  
    }  
    
    public class CustomBottomNavAppearance : IShellBottomNavViewAppearanceTracker  
    {  
        public void Dispose()  
        {      
        }  
        public void ResetAppearance(BottomNavigationView bottomView)  
        {  
            throw new NotImplementedException();  
        }         
        public void SetAppearance(BottomNavigationView bottomView, IShellAppearanceElement appearance)  
        {  
            var instance = MainActivity.mactivity;  
            int width = instance.width;  
    
            if(width>??)  
            {  
                var bottomNavMenuView = bottomView.GetChildAt(0) as BottomNavigationMenuView;  
    
                for (int i = 0; i < bottomNavMenuView.ChildCount; i++)  
                {  
                    var item = bottomNavMenuView.GetChildAt(i) as BottomNavigationItemView;  
                    var itemicon = item.GetChildAt(0);  
                    var itemTitle = item.GetChildAt(1);  
    
                    var IconImageView = (ImageView)itemicon;  
                    var smallTextView = ((TextView)((BaselineLayout)itemTitle).GetChildAt(0));  
                    var largeTextView = ((TextView)((BaselineLayout)itemTitle).GetChildAt(1));  
    
                    IconImageView.SetImageResource(Resource.Drawable.check);  
                    smallTextView.TextSize = 18;  
                    largeTextView.TextSize = 18;  
    
                }  
            }  
    
        }  
    }  
    

    2.Getting current screen size in Mainactivity.cs:

    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity  
    {  
        public static MainActivity mactivity;  
        public int width { get; set; }  
        protected override void OnCreate(Bundle savedInstanceState)  
        {  
            TabLayoutResource = Resource.Layout.Tabbar;  
            ToolbarResource = Resource.Layout.Toolbar;  
    
            base.OnCreate(savedInstanceState);  
    
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);  
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);  
            LoadApplication(new App());  
    
            var metrics = Resources.DisplayMetrics;  
            width = metrics.WidthPixels;  
            mactivity = this;  
        }  
        public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)  
        {  
            Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);  
    
            base.OnRequestPermissionsResult(requestCode, permissions, grantResults);  
        }  
    }  
    

    Best Regards,

    Jessie Zhang


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.