css to make bootstrap navbar transparent
I was able to make the navigation bar transparent by adding a new .transparent class to the .navbar and setting the CSS like this:
.navbar.transparent.navbar-inverse .navbar-inner {
border-width: 0px;
-webkit-box-shadow: 0px 0px;
box-shadow: 0px 0px;
background-color: rgba(0,0,0,0.0);
background-image: -webkit-gradient(linear, 50.00% 0.00%, 50.00% 100.00%, color-stop( 0% , rgba(0,0,0,0.00)),color-stop( 100% , rgba(0,0,0,0.00)));
background-image: -webkit-linear-gradient(270deg,rgba(0,0,0,0.00) 0%,rgba(0,0,0,0.00) 100%);
background-image: linear-gradient(180deg,rgba(0,0,0,0.00) 0%,rgba(0,0,0,0.00) 100%);
}
My markup is like this
<div class="navbar transparent navbar-inverse">
<div class="navbar-inner">....
Transparent iOS navigation bar
You can apply Navigation Bar Image like below for Translucent.
Objective-C:
[self.navigationController.navigationBar setBackgroundImage:[UIImage new]
forBarMetrics:UIBarMetricsDefault]; //UIImageNamed:@"transparent.png"
self.navigationController.navigationBar.shadowImage = [UIImage new];////UIImageNamed:@"transparent.png"
self.navigationController.navigationBar.translucent = YES;
self.navigationController.view.backgroundColor = [UIColor clearColor];
Swift 3:
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default) //UIImage.init(named: "transparent.png")
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.isTranslucent = true
self.navigationController?.view.backgroundColor = .clear
Make nav bar transparent when resting at the top of the page?
Here ya go. You need to detect when the user scrolls to update the header styles
// When the user scrolls the page, execute myFunction
window.onscroll = function() {myFunction()};
// Get the header
var header = document.getElementById("myHeader");
// Get the offset position of the navbar
var sticky = header.offsetTop;
// Add the solid class to the header when you reach its scroll position. Remove "solid" when you leave the scroll position
function myFunction() {
if (window.pageYOffset > sticky) {
header.classList.add("solid");
} else {
header.classList.remove("solid");
}
}
body { background-color: gray; }
header {
height: 75px;
width: 100%;
position: sticky;
top: 20px;
transition: all 0.5s;
background-color: lightblue;
}
header.solid {
background-color: darkgray;
}
.tall {
width: 100%;
height: 1500px;
}
<header id="myHeader"><span>The Header</span></header>
<div class="tall">
<p>Tall DIV</p>
</div>
How can I make the Navigation Bar transparent?
Try this:
extension UIViewController {
func blurNav(withAlpha alpha:CGFloat = 1.0 ) {
let statusBarHeight = view.window?.windowScene?.statusBarManager?.statusBarFrame.height ?? 0
let rect = navigationController?.navigationBar.bounds.insetBy(dx: 0, dy: -(statusBarHeight)).offsetBy(dx: 0, dy: -(statusBarHeight)) ?? .zero
let blurView = UIVisualEffectView(effect: UIBlurEffect(style: .light))
blurView.frame = rect
blurView.isUserInteractionEnabled = false
blurView.alpha = alpha
blurView.layer.zPosition = -1
blurView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
navigationController?.navigationBar.addSubview(blurView)
navigationController?.navigationBar.sendSubviewToBack(blurView)
}
}
Usage:
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
blurNav(withAlpha: 0.8)
}
How to make bottom system navigation bar transparent in flutter?
Found the answer from this GitHub discussion.
In android/app/build.gradle
dependencies {
implementation 'androidx.core:core-ktx:1.5.0-beta01'
}
In android/app/src/main/kotlin/com/example/edge2edge/MainActivity.kt
package com.example.edge2edge
import androidx.core.view.WindowCompat
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
override fun onPostResume() {
super.onPostResume()
WindowCompat.setDecorFitsSystemWindows(window, false).
}
}
In main.dart
void main() {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
statusBarIconBrightness: Brightness.dark,
systemNavigationBarColor: Colors.transparent,
));
runApp(MyApp());
}
How to make a transparent bottom navigation bar in flutter
try this:
Scaffold(
extendBody: true,
Transparent bottom navigation bar in flutter
My attempt using the Stack method discussed in the comments:
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Stack(
children: <Widget>[
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/background.jpg'),
fit: BoxFit.cover),
),
),
Align(
alignment: Alignment.bottomCenter,
child: Theme(
data: Theme.of(context)
.copyWith(canvasColor: Colors.transparent),
child: BottomNavigationBar(
currentIndex: 0,
items: [
BottomNavigationBarItem(
icon: Icon(Icons.home), title: Text('Home')),
BottomNavigationBarItem(
icon: Icon(Icons.home), title: Text('Home')),
BottomNavigationBarItem(
icon: Icon(Icons.home), title: Text('Home'))
],
))),
],
),
),
);
}
Edit: The BottomNavigationBar
has an inbuilt elevation of 8.0
which you can't change and is causing that weird shadow effect. If you want to remove it, you could just implement your own kind of bottom bar like so:
Align(
alignment: Alignment.bottomCenter,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
IconButton(icon: Icon(Icons.home, color: Theme.of(context).accentColor,), onPressed: () {},),
IconButton(icon: Icon(Icons.home, color: Theme.of(context).accentColor,), onPressed: () {},),
IconButton(icon: Icon(Icons.home, color: Theme.of(context).accentColor,), onPressed: () {},),
],)),
Related Topics
Fragment Standard Transition Not Animating
Ionic Cordova App Stopped Compiling After Google's June 17Th Firebase Sdk Update
Set Starting Height of Collapsingtoolbarlayout
Get Application Installed Date on Android
Notification Passes Old Intent Extras
How to Add The Icon for Swipeable Tabs
Add Viewpagerindicator to Android Studio
Inform Activity from a Broadcastreceiver Only If It Is in The Foreground
Replace Fragment with Another Fragment Inside Viewpager
Creating Custom Overlay on The Map
Loop Through All Subviews of an Android View
View Pager + Imageview +Pinch Zoom + Rotation