-
Notifications
You must be signed in to change notification settings - Fork 97
/
App.xaml.cs
executable file
·93 lines (74 loc) · 3.1 KB
/
App.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
using System;
using System.Collections.Generic;
using System.Linq;
using BottomBar.XamarinForms;
using Xamarin.Forms;
namespace BottomBarXFExample
{
public partial class App : Application
{
public App ()
{
InitializeComponent ();
BottomBarPage bottomBarPage = new BottomBarPage ();
//bottomBarPage.BarBackgroundColor = Color.Pink;
// You can only define the color for the active icon if you set the Bottombar to fixed mode
// So if you want to try this, just uncomment the next two lines
//bottomBarPage.BarTextColor = Color.Blue; // Setting Color of selected Text and Icon
//bottomBarPage.FixedMode = true;
// Whith BarTheme you can select between light and dark theming when using FixedMode
// When using DarkTheme you can set the Background Color by adding a colors.xml to you Android.Resources.Values
// with content
//
// <color name="white">#ffffff</color>
// < color name = "bb_darkBackgroundColor" >#000000</color>
//
// by setting "white" you can select the color of the non selected items and texts in dark theme
// The Difference between DarkThemeWithAlpha and DarkThemeWithoutAlpha is that WithAlpha will draw not selected items with halfe the
// intensity instaed of solid "white" value
//
// Uncomment next line to use Dark Theme
// bottomBarPage.BarTheme = BottomBarPage.BarThemeTypes.DarkWithAlpha;
string[] tabTitles = { "Favorites", "Friends", "Nearby", "Recents", "Restaurants" };
string [] tabColors = { null, "#5D4037", "#7B1FA2", "#FF5252", "#FF9800" };
int[] tabBadgeCounts = {0, 1, 5, 3, 4};
string[] tabBadgeColors = {"#000000", "#FF0000", "#000000", "#000000", "#000000"};
for (int i = 0; i < tabTitles.Length; ++i) {
string title = tabTitles [i];
string tabColor = tabColors [i];
int tabBadgeCount = tabBadgeCounts[i];
string tabBadgeColor = tabBadgeColors[i];
FileImageSource icon = (FileImageSource) FileImageSource.FromFile (string.Format ("ic_{0}.png", title.ToLowerInvariant ()));
// create tab page
var tabPage = new TabPage () {
Title = title,
Icon = icon
};
// set tab color
if (tabColor != null) {
BottomBarPageExtensions.SetTabColor(tabPage, Color.FromHex(tabColor));
}
// Set badges
BottomBarPageExtensions.SetBadgeCount(tabPage, tabBadgeCount);
BottomBarPageExtensions.SetBadgeColor(tabPage, Color.FromHex(tabBadgeColor));
// set label based on title
tabPage.UpdateLabel ();
// add tab pag to tab control
bottomBarPage.Children.Add (tabPage);
}
MainPage = bottomBarPage;
}
protected override void OnStart ()
{
// Handle when your app starts
}
protected override void OnSleep ()
{
// Handle when your app sleeps
}
protected override void OnResume ()
{
// Handle when your app resumes
}
}
}