i want to customize app bar when use drawer in android studio
how can remove this title on appbar
Thanks.
this is my code in the oncreate()
DrawerLayout drawer = binding.drawerLayout;
NavigationView navigationView = binding.navView;
mAppBarConfiguration = new AppBarConfiguration.Builder(
R.id.nav_home, R.id.nav_gallery, R.id.nav_slideshow)
.setOpenableLayout(drawer)
.build();
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_content_main);
NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
NavigationUI.setupWithNavController(navigationView, navController);
Related
Context
I have an app that runs only from the macOS menubar. (The LSUIElement property in info.plist is set to YES).
Instead of a menu, this app shows an NSPopover when the menubar button is clicked. The popover holds an NSHostingView which has an extremely simple SwiftUI view:
struct PopoverContentView: View
{
#State private var color: CGColor = .white
var body: some View
{
ColorPicker(selection: $color) {
Text("Pick a Color:")
}
}
}
Problem
Clicking on the ColorPicker() does not open the macOS color picker window. The UI of the ColorPicker() button changes, to show the "selected" border state but the color-picker window never appears.
However, if I change LSUIElement to be NO and then make the app active by clicking its Dock icon (so that it takes over the menubar), THEN clicking on the ColorPicker() in the popover actually reveals the color-picker window.
Do you know of a way to force macOS to show the color-picker window for a background application?
The answer turned out to be simple. In the AppKit ViewController that opens the popover when the menubar button is clicked (PopoverController, for me), I simply did this:
extension PopoverController: NSPopoverDelegate
{
func popoverWillShow(_ notification: Notification)
{
NSApp.activate(ignoringOtherApps: true)
}
}
The ColorPicker now correctly shows the standard macOS system color panel on click.
I am writing a SwiftUI app that uses a MenuBarExtra on macOS. When I click on the menu bar item, it displays as expected, however if I am in a fullscreen app, the window does not appear in that space; toggling to an non-fullscreen app shows it there.
Is there any way to make the window appear in fullscreen apps? In an AppKit app I'd do this when making the window:
window.collectionBehavior = [.canJoinAllSpaces, .stationary, .fullScreenAuxiliary]
Is there any way to do something like that from SwiftUI? Clicking on the menu bar item and nothing appearing is not a great user experience.
Here's my code:
#main
struct MyApp: App {
#StateObject var model = Model()
var body: some Scene {
#if os(macOS)
MenuBarExtra(model.statusString) {
ContentView()
.environmentObject(model)
}
.menuBarExtraStyle(.window)
#else
...
I am trying to change status bar letters color...I want white letters.
I am trying that using this line in 'AppDelegate':
UIApplication.SharedApplication.SetStatusBarStyle(statusBarStyle: UIStatusBarStyle.LightContent, animated: false);
It's not working...Can someone help me?
Pleaseeeeeee
The solution is to set the NavigationPage BarTextColor to white when the page is first created in app.xaml.cs
MainPage = new NavigationPage(new Views.Splash2()) { BarTextColor = Color.White };
I've got a TabView in my NativeScript page. The tabs content is programmatically populated.
How to hide / collapse the tabs buttons (because the tabs are switched programmatically)?
see Image above of TabView buttons bar - which needs to be collapsed
You can try
For ios:
var myTabView = page.getViewById("myTabView")
myTabView.ios.tabBar.hidden = true;
For android
myTabView.android.removeViewAt(1);
A better solution for android (I hope i translated it correctly from my working nativescript angular code)
const tabLayout = myTabView.android.tabLayout;
// use native android methods to hide the tabLayout containing the tab buttons
if(isFullscreen) {
tabLayout.setVisibility(android.view.View.GONE);
} else {
tabLayout.setVisibility(android.view.View.VISIBLE);
}
I'm using Visual Studio 2015 and made a Xamarin project to support iOS, Android and UWP.
I want rebrand the toolbar, and on iOS and Android its possible to set a background color and a picture in the toolbar.
But for Universal Windows Platform this seems impossible.
So I want to set my own TopAppBar with a picture, and hide the current toolbar for UWP;
In my MainPage.xaml.cs I've;
#if __ANDROID__ || __IOS__
ToolbarItems.Add(new ToolbarItem("+", "", () => App.Navigation.PushAsync(new AddAccount())));
#endif
So for UWP there would be no items on the toolbar. But it still appears.
I cannot find any documentation on how to;
-customize the toolbar for UWP
-hide the toolbar for UWP
I've tried to add a toolbar like so;
var _globalAppBar = new AppBar();
_globalAppBar.Height = 128;
_globalAppBar.Background = new SolidColorBrush(Colors.Green);
BitmapImage bmI = new BitmapImage();
bmI = new BitmapImage(new Uri("ms-appx:///Assets/logo.png", UriKind.RelativeOrAbsolute));
var imageBrush = new ImageBrush();
imageBrush.ImageSource = bmI;
_globalAppBar.Background = imageBrush;
AppBarButton abbtn = new AppBarButton();
abbtn.Label = "Add";
_globalAppBar.Content = abbtn;
this.BottomAppBar = _globalAppBar;
But that results in having two toolbars at the top...
So it's better to modify the existing toolbar created by Xamarin, but I don't know how to access it from the 'public MainPage()' of the UWP project.
I just tried to redo your problem. I can hide the toolbar when I clear the toolbaritems.
Also I have to call
NavigationPage.SetHasNavigationBar(this, false);
on the page.