S
S
semax952016-01-13 06:57:26
Android
semax95, 2016-01-13 06:57:26

How to fix toolbar in android?

How to make it so that when the keyboard appears, the status bar does not disappear?
screen 1
screen 2
I work in Android studio.
xml:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fitsSystemWindows="true"
    tools:context="pushtest.ru.mypush.Main2Activity"
    android:fadeScrollbars="false">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay"
        android:orientation="vertical"
        android:windowSoftInputMode="stateVisible|adjustResize">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay"
            android:scrollbarAlwaysDrawHorizontalTrack="true"
            android:scrollbarAlwaysDrawVerticalTrack="true"
            />

    </android.support.design.widget.AppBarLayout>
    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        android:src="@android:drawable/ic_dialog_email"
        android:onClick="onMyButtonClick" />
    <include layout="@layout/content_main2" />

</android.support.design.widget.CoordinatorLayout>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ilya Fomenko, 2016-01-13
@adonixis

In the manifest, in the properties of this activity, write

android:windowSoftInputMode="stateVisible|adjustResize"

A
Alexey Perelygin, 2016-01-13
@orcDamnar

It would not be bad to see xml with screen layout. I think that putting the whole block in some NestedScrollView would solve the problem.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question