Android Q Edge to Edge app content not showing transparent navigation bar - android-10.0

I followed the documentation of making the Gestural Navigation to extend the app edge to edge. But I am not able to see the navigation bar changing into transparent.
build.gradle settings,
compileSdkVersion 'android-Q'
minSdkVersion 21
targetSdkVersion 28
styles values,
<!-- Testing Edge to Edge app content -->
<item name="android:navigationBarColor">#android:color/transparent</item>
<!-- Optional, but recommended for full edge-to-edge rendering -->
<item name="android:statusBarColor">#android:color/transparent</item>
I set the UI visibility flags in onCreate() method
// Adding UI Visibility flag for edge to edge app content
View view = findViewById(R.id.mainView);
// hide navigation
// view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
// layout stable
// view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
// view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);
// view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_FULLSCREEN);
// having two flags hide navigation or layout fullscreen
// view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
// having two flags hide navigation or layout stable
view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);

Try This:
View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);

Related

Change status Bar color in Xamarin Forms iOS [duplicate]

I am unable to change the status bar text color of my Xamarin Forms iOS app to white. I have change in my info.plist as follow:
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
Yet the color still remain black.. Is there another way to change the status bar text color?
In Xamarin.Forms, there are three things you need to do to achieve white text in the iOS Status Bar. I've also posted a sample Xamarin.Forms app below that uses white text in the iOS Status Bar.
1. Update the Info.plist
In Info.plist, add the Boolean Property View controller-based status bar appearance and set its value to No
2. Use a NavigationPage & Set the Navigation Bar Text Color to White
In the Application class (typically App.cs), the MainPage must be a NavigationPage, and the BarTextColor must be set to Color.White
3. Clean & Rebuild the App
Sometimes the compiler doesn't update the Status Bar Color until you Clean and Rebuild the app, so after making the changes in steps 1 & 2, clean the app and rebuild it.
Sample App
https://github.com/brminnick/SaveImageToDatabaseSampleApp/
The only way to change status bar in IOS for me was to use this code in FinishedLaunching in AppDelegate
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init ();
LoadApplication (.....);
app.SetStatusBarStyle(UIStatusBarStyle.LightContent, true);
return base.FinishedLaunching (app, options);
}
So what I did for changing status bar color and status bar text color is:
Info.plist
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<!--<key>UIStatusBarHidden</key>-->
<!--<true/>-->
AppDelegate
Inside function FinishedLaunching(), add code below:
UIView statusBar = UIApplication.SharedApplication.ValueForKey(new NSString("statusBar")) as UIView;
if (statusBar != null && statusBar.RespondsToSelector(new ObjCRuntime.Selector("setBackgroundColor:")))
{
statusBar.BackgroundColor = Color.FromHex("#7f6550").ToUIColor(); // change to your desired color
}
App.xaml
I added code below to change status bar text color to White.
<Style TargetType="{x:Type NavigationPage}">
<!--<Setter Property="BarBackgroundColor" Value="Black" />-->
<Setter Property="BarTextColor" Value="White" />
</Style>
Select the NavigationBar and change the Style property to Black.
In my case, adding this to AppDelegate FinishedLaunching worked:
UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;

Make horizontal scroll for bootsfaces modal

I'm working with PrimeFaces and BootsFaces libraries. I have a little form inside bootsfaces modal. The form is used to change system parameters, and for one specific parameter has a <p:keyboard /> to change its value. My problem is that in extra-small devices, the bootstrap modal doesn't allow horizontal scroll, and the keyboard is not showing complete:
The keyboard is not responsive by default when the viewport with is less than 510px, so I have adjusted it to 436px by default in extra small screens. I want to make horizontal scroll on the modal just to see the complete keyboard, but only when I open the modal.
This is my javascript function to adjust the keyboard depending on screen size:
$(document).on('click', '.inpKeyboard', function() {//- The input text has a class called 'inpKeyboard'
if ($(window).width() <= 505) {//- Small screen
$('#keypad-div').css('width', '436px');
$('#keypad-div').css('left', '0px');
//$('.modal-open').css('overflow-x', 'auto');
}
$('#keypad-div').css('z-index', '2000');
});
Any help would be appreciated. Thanks.
What a nice puzzle! :) PrimeFaces calculate the size of the keypad window in JavaScript and stores it as an inline-style. So the clue to solving this is to add a timeout, like so:
<script>
$(document).on('click', '.hasKeypad', () => {
$('#keypad-div').css('z-index', '2000');
if (!(window.width > 505)) { // JSF (i.e. XML) doesn't accept the less-than-operator
// add a timeout to make sure the code is executed after PrimeFaces did its magic
setTimeout(() => {
// set a fixed with
$('#keypad-div').css('width', '436px');
// add the horizontal scrollbar
$('#keypad-div').css('overflow-x', 'auto');
// increase the height to make space for the scrollbar
$('#keypad-div').css('height', '180px');}
,1);
}
});
</script>
<!-- set a minimum width for the keyboard rows -->
<!-- (otherwise the key overflow to the next row) -->
<style>
#media screen and (max-width: 504px) {
.keypad-row {
min-width:470px;
}
}
</style>

TopLayoutGuide and BottomLayoutGuide Deprecated in iOS 11

UIViewController's topLayoutGuide and bottomLayoutGuide are deprecated in iOS 11. What should be the replacement?
Previously in your UIViewController:
customView.topAnchor.constraint(equalTo: topLayoutGuide.bottomAnchor).isActive = true
customView.bottomAnchor.constraint(equalTo: bottomLayoutGuide.topAnchor).isActive = true
Now you should use:
customView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor).isActive = true
customView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor).isActive = true
Note the change from bottomAnchor to topAnchor. This is because the top layout guide was a rectangle at the top of the view controller, so in order to constraint your content to the top, you wanted the bottom anchor of the guide. The new safe are layout guide is a rectangle portion of the view unobscured by bars and other content, so you want the top anchor. And vice-versa for the bottom layout guide.

hide navigation bar programmatically while application running

I am developing an android game with webview layout. I would like to hide the navigation bar while the user is playing the game. I have found some solutions but when I touch the screen the navigation bar shows up.
What am I doing wrong? Here is my non-working solution:
int mUIFlag = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LOW_PROFILE
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
getWindow().getDecorView().setSystemUiVisibility(mUIFlag);
you need to make use of following piece of code to reset the flags again :
View decorView = getWindow().getDecorView();
decorView.setOnSystemUiVisibilityChangeListener
(new View.OnSystemUiVisibilityChangeListener() {
#Override
public void onSystemUiVisibilityChange(int visibility) {
// Note that system bars will only be "visible" if none of the
// LOW_PROFILE, HIDE_NAVIGATION, or FULLSCREEN flags are set.
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
decorView.setSystemUiVisibility(mUIFlag);
} else {
// TODO: The system bars are NOT visible. Make any desired
// adjustments to your UI, such as hiding the action bar or
// other navigational controls.
}
}
});
also, read through this page to know how to handle your scenario

QT/C++ on MAC - How do I hide my dock icon?

I'd like my dock icon to be hidden and the app to be represented as a menu bearing icon on the menu bar (right hand side).
This will hide the icon:
http://www.macosxtips.co.uk/index_files/disable-the-dock-icon-for-any-application.html
Summarizing the URL, in the dict xml element inside Info.plist in the app, add the lines:
<key>LSUIElement</key>
<string>1</string>
You need to use the appropriate OS APIs to add the menu.
The alternative answer is by using TransformProcessType() to show/hide dock icon dynamically in code.
#import <Foundation/Foundation.h>
void toggleDockIcon(bool show) {
ProcessSerialNumber psn = {0, kCurrentProcess};
if (show) {
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
} else {
TransformProcessType(&psn, kProcessTransformToUIElementApplication);
}
}

Resources