TabControl with Add New Tab Button (+)

An almost complete solution using IEditableCollectionView: ObservableCollection<ItemVM> _items; public ObservableCollection<ItemVM> Items { get { if (_items == null) { _items = new ObservableCollection<ItemVM>(); var itemsView = (IEditableCollectionView)CollectionViewSource.GetDefaultView(_items); itemsView.NewItemPlaceholderPosition = NewItemPlaceholderPosition.AtEnd; } return _items; } } private DelegateCommand<object> _newCommand; public DelegateCommand<object> NewCommand { get { if (_newCommand == null) { _newCommand = new DelegateCommand<object>(New_Execute); } return … Read more

How add tabs programmatically in UITabBarController with swift?

UPDATE SWIFT 5 One example of how to create an UITabBarController programmatically could be like this: First we create the UIViewControllers that will be the content for each tab of the tab bar interface. For this example we only create one very simple. class Item1ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = UIColor.green … Read more

How do I change the background of an Android tab widget?

This will set your tab colors: public static void setTabColor(TabHost tabhost) { for(int i=0;i<tabhost.getTabWidget().getChildCount();i++) { tabhost.getTabWidget().getChildAt(i).setBackgroundColor(Color.parseColor(“#FF0000”)); //unselected } tabhost.getTabWidget().getChildAt(tabhost.getCurrentTab()).setBackgroundColor(Color.parseColor(“#0000FF”)); // selected } and if you put it within the onTabChangedListener(), it will keep the correct color for selected tabs.

Remove line break in TabLayout

Here’s a quick hack, a lot shorter than using setCustomView(): use the android:theme attribute on your TabLayout: <android.support.design.widget.TabLayout android:id=”@+id/tab_layout” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:theme=”@style/TabLayout_Theme” app:tabMode=”fixed”/> Then in your themes XML: <style name=”TabLayout_Theme” parent=”@style/AppTheme”> <item name=”android:singleLine”>true</item> </style> We have to do it this way, because unfortunately the android:singleLine attribute is ignored on the app:tabTextAppearance set on the TabLayout. … Read more

No resource identifier found for attribute ‘layout_behavior’ in package

That string resource is defined within the Material Design support library. Since you’re not using the CoordinatorLayout from the Material Design support library, you should be able to safely remove the app:layout_behavior attribute. It was probably cut & paste from other code. NOTE: If you are actually using CoordinatorLayout and want the cooperative scrolling behaviors … Read more

Is it possible to change actionbar tab indicator programmatically

I have succeeded to implement what i wanted by using @Padma’s answer to generate my tab indicator backgrounds : i needed 5 selectors : green, yellow, blue, orange and red. So i created 5 xml drawables (tabs_selector_red.xml, tabs_selector_blue.xml, etc…) : tabs_selector_green.xml : <!– Non focused states –> <item android:drawable=”@android:color/transparent” android:state_focused=”false” android:state_pressed=”false” android:state_selected=”false”/> <item android:drawable=”@drawable/layer_bg_selected_tabs_green” android:state_focused=”false” … Read more