Answer the question
In order to leave comments, you need to log in
Xamarin.android ToggleSoftInput how to make FullScreen?
Hello
, I need to show the software keyboard without losing the full-screen mode when the navigation and status bar are removed from the screen, but something doesn't work. The same thing happens as when calling Dialog or alert - system controls appear. How to avoid it?
here are the pieces of my code
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
public static Activity MyActivity;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
MyActivity = this; //костыль для имплементации интерфейса, который покажет клавиатуру
View decorView = Window.DecorView;
var uiOptions = (int)decorView.SystemUiVisibility;
int newUiOptions = (int)uiOptions;
newUiOptions |= (int)SystemUiFlags.LayoutStable;
newUiOptions |= (int)SystemUiFlags.LayoutHideNavigation;
newUiOptions |= (int)SystemUiFlags.LayoutFullscreen;
newUiOptions |= (int)SystemUiFlags.HideNavigation;
newUiOptions |= (int)SystemUiFlags.Fullscreen;
newUiOptions |= (int)SystemUiFlags.ImmersiveSticky;
decorView.SystemUiVisibility = (StatusBarVisibility)newUiOptions;
// Это переводит приложение в полноэкранный режим, где спрятаны все элементы управления
}
}
public class CMyKeyboardShower: IMyKeyboardShower
{
public void ShowKeyboard()
{
InputMethodManager inputMethodManager = MainActivity.MyActivity.GetSystemService(Context.InputMethodService) as InputMethodManager;
inputMethodManager.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.ImplicitOnly);
//клавиатура появляется и возвращает системные элементы экрана
}
}
MainActivity.MyActivity.RunOnUiThread(() =>
{
var alert = new AlertDialog.Builder(MainActivity.MyActivity);
alert.SetView(MainActivity.me_act.LayoutInflater.Inflate(Resource.Layout.layout1, null));
alert.Create().Show();
});
Answer the question
In order to leave comments, you need to log in
This is how it is done correctly - https://jsfiddle.net/webirus/83dnadce/3/
You need to set normalize.css or reset.css , then you won't have to crutch each indent separately.
Otherwise, the layout will be crooked, and you will get tired of editing in every place.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question