1

I have a activity

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    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:id="@+id/rootLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@mipmap/img"
    tools:context=".MainActivity">

    <LinearLayout
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:background="#00ff00"
        android:orientation="vertical"
        android:padding="12dp"
        app:layout_constraintBottom_toTopOf="@+id/bottomLayout"
        app:layout_constraintLeft_toLeftOf="parent">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="#2196F3"
            android:text="1111" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="4dp"
            android:background="#2196F3"
            android:text="2222" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="4dp"
            android:background="#2196F3"
            android:text="3333" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="4dp"
            android:background="#2196F3"
            android:text="4444" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/bottomLayout"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:background="@color/purple_200"
        android:gravity="center"
        android:orientation="vertical"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent">

        <EditText
            android:id="@+id/edittext"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

enter image description here

when i click the edittext

the keyboard will push all view

enter image description here

but if the background be pushed the image will be cut

So when the edittext clicked

I want to push: edittext, others view

I don't want to push: background view

How to achieve it?

P.S. I found many solution just use android:windowSoftInputMode="adjustPan" but it will push all the views not work in my case.

GHH
  • 1,713
  • 1
  • 8
  • 21
  • 1
    Does this help [android-resize-only-parts-of-view-with-soft-keyboard-on-screen](https://stackoverflow.com/questions/21201569/android-resize-only-parts-of-view-with-soft-keyboard-on-screen) – Nitish Jun 02 '22 at 09:22

0 Answers0