Моя активность использования CollapsingToolbarLayout и я удалить успешно в StatusBar
делает это:StatusBar показывает, когда клавиатура появляется
View decorView = getWindow().getDecorView();
// Hide the status bar.
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
Проблема заключается в том, что, когда softkeyboard
всплывает вверх, StatusBar
появляются снова, потребляя драгоценное пространство.
Как удержать его постоянно на ?
Если я установил его в FullScreen, он работает, но я потерял параметр SOFT_INPUT_ADJUST_RESIZE
. Главное окно прокручивается, когда появляется softkeyboard
, вместо того, чтобы изменять размер по мере необходимости.
Обновление:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/my_appar"
android:fitsSystemWindows="false"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:background="@color/white">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:toolbarId="@+id/collapsetoolbar"
app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed"
app:layout_scrollInterpolator="@android:anim/decelerate_interpolator"
app:contentScrim="?attr/colorPrimary">
<android.support.v7.widget.Toolbar
android:id="@+id/my_toolbar"
android:elevation="4dp"
android:layout_height="wrap_content"
android:layout_width="match_parent">
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_id"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="... .MyActivity"
android:orientation="vertical"
>
<FrameLayout
android:id="@+id/yt_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<fragment
...
</FrameLayout>
<com.byte_artisan.mchat.compoundViews.chatview.ChatView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/fragment1"
android:id="@+id/chat_view_id">
</com.byte_artisan.mchat.compoundViews.chatview.ChatView>
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
Код:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mchat);
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
..
}
@Override
protected void onResume() {
super.onResume();
View decorView = getWindow().getDecorView();
// Hide the status bar.
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
}
Активность использует схему NoActionBar (объявленный на манифест).
размещать код макета – Jayanth