Смещение Activity при активации экранной клавиатуры Android
Не один час мучаюсь, помогите решить проблему. Что-то в проекте сбилось и теперь активити не смещается при появлении клавиатуры и соответственно клавиатура перекрывает активити. Пробовал код java и xml скопировать в другой проект - там это работает. В чем может быть проблема? В манифесте прописал android:windowSoftInputMode="adjustPan" Активити:
package com.example.readme;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
public class MainActivity2 extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
}
}
XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:id="@+id/fragment_learn_words"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="96dp"
android:layout_marginRight="2dp"
android:layout_marginLeft="2dp"
android:layout_marginTop="2dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/ivWord"
android:layout_width="96dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginRight="0.5dp"
android:gravity="center"
android:src="@android:drawable/ic_dialog_dialer"
android:scaleType="centerCrop" />
<TextView
android:id="@+id/tvWord"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="0.5dp"
android:background="?attr/colorPrimary"
android:gravity="center"
android:text="empty"
android:textSize="35sp"
android:textStyle="bold" />
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="1dp"
android:layout_weight="0.4">
<EditText
android:id="@+id/etEnterWord"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="2dp"
android:layout_marginLeft="2dp"
android:background="@android:color/darker_gray"
android:gravity="center_horizontal"
android:hint="etHintEnterWord"
android:inputType="textNoSuggestions"
android:maxLength="15"
android:minLines="1"
android:textSize="35sp"
android:textStyle="bold" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:layout_marginLeft="2dp"
android:layout_margin="2dp"
android:layout_marginTop="1dp"
android:orientation="horizontal">
<Button
android:id="@+id/btnHelp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="0.5dp"
android:layout_weight="1"
android:background="?attr/colorPrimary"
android:gravity="center"
android:text="\?"
android:textSize="30dp" />
<Button
android:id="@+id/btnCheck"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="0.5dp"
android:layout_weight="0.4"
android:background="?attr/colorPrimary"
android:gravity="center"
android:text="Проверить"
android:textSize="30dp" />
<Button
android:id="@+id/btnNextWord"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="?attr/colorPrimary"
android:gravity="center"
android:text="->"
android:textSize="30dp" />
</LinearLayout>
</LinearLayout>
Манифест:
<activity
android:name=".MainActivity"
android:windowSoftInputMode="adjustPan"/>