Android Action Bar Tabs, Styling the Icon and Text together

后端 未结 2 1684
萌比男神i
萌比男神i 2020-12-09 23:11

Firstly, there is the image of my current tab bar \"enter

What I want is either aligni

2条回答
  •  南方客
    南方客 (楼主)
    2020-12-10 00:11

    My solution isn't perfect, but to move the icons above the text here is what I have so far, which might be able to help you.

    TabLayout.axml

    
    
        
        
    
    

    MainActivity.cs

     void AddTabToActionBar(int labelResourceId, int iconResourceId)
            {
                var tab = this.ActionBar.NewTab();
                tab.SetCustomView(Resource.Layout.Tablayout);
                tab.CustomView.FindViewById(Resource.Id.tabImage).SetImageResource(iconResourceId);
                tab.CustomView.FindViewById(Resource.Id.tabText).SetText(labelResourceId);
                tab.TabSelected += TabOnTabSelected;
                ActionBar.AddTab(tab);
    
            }
    

提交回复
热议问题