I am unable to modify the layout when opening the keyboard

Asked

Viewed 117 times

0

I’m trying to "decrease" the layout when opening the keyboard, but I’m not getting it, it’s inside a ScrollView and I realized that he ignores the free space below the views (where there are no views), but does not ignore what is above them (here showing the layout with the open keyboard: https://imgur.com/a/T2JPB, There is another edittext down there that doesn’t appear, da para ver isso no xml), can I ignore it when opening the keyboard? I’ve seen in some topics here on the site (this I need to squeeze my layout when I open the keyboard gave the idea of the ScrollView), but none worked, I tried to use the android:windowSoftInputMode="adjustResize" as the answer to this topic https://stackoverflow.com/questions/16411056/how-to-adjust-layout-when-soft-keyboard-appears indicates, with this line or without it the layout is the same thing, someone knows how to solve?

Androidmanifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="ToBuy.ToBuy" android:versionCode="1" android:versionName="1.0" android:installLocation="auto">
  <uses-sdk android:minSdkVersion="14" />
  <application android:allowBackup="true" android:label="@string/app_name" android:theme="@style/AppTheme" android:icon="@drawable/ic_launcher">
    <activity android:name=".EditItemActivity" android:windowSoftInputMode="adjustResize"/>
  </application>
</manifest>

Layout

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <android.support.v7.widget.Toolbar
        style="@style/ToolbarStyle"
        android:id="@+id/toolbar"
        app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:gravity="center">
            <TextView
                android:layout_marginTop="100dp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:text="Informações do Item:" />
            <EditText
                android:layout_width="200dp"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:maxLines="1"
                android:hint="Nome"
                android:inputType="textCapSentences"
                android:id="@+id/eTNome" >
                <requestFocus />
            </EditText>
            <EditText
                android:layout_width="200dp"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:maxLines="1"
                android:hint="Preço"
                android:inputType="number"
                android:id="@+id/eTPreco" />
            <SeekBar
                android:id="@+id/sBImport"
                android:layout_width="200dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="15dp"
                android:layout_gravity="center"
                android:max="99"
                android:progress="33" />
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:gravity="center">
                <TextView
                    android:id="@+id/tVImport"
                    android:layout_width="wrap_content"
                    android:layout_height="24dp"
                    android:gravity="center"
                    android:text="1. Baixa importância" />
                <ImageButton
                    android:id="@+id/btnHelp"
                    android:layout_width="24dp"
                    android:layout_height="24dp"
                    android:layout_marginRight="5dp"
                    android:background="#ffffff"
                    android:src="@drawable/ic_help" />
            </LinearLayout>
            <EditText
                android:layout_width="200dp"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:gravity="top|left"
                android:layout_marginTop="15dp"
                android:hint="Anotações extras (opcional)"
                android:minLines="4"
                android:background="@drawable/edittext"
                android:inputType="textMultiLine|textCapSentences"
                android:id="@+id/eTNotas" />
        </LinearLayout>
    </ScrollView>
</LinearLayout>
  • It would be like putting a print/photo of the app screen when it is in the "wrong" way you mentioned?

  • @Perozzo the screen does not get "wrong" it looks like it was with the keyboard closed, I wanted it to be "squeezed" and be all in the visible part, kind of ignore the white spaces, I tried in the Android Studio with the same layout and tbm did not work (there is a photo of him in the link Imgur there, I did not put the question because I thought it would get too big)

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.