I am trying to have an AutoCompleteTextView at the bottom of the screen but its behavior is inconsistent and confusing. I had achieved it somehow but I changed some code I am unable to trace and now while typing, drowpdown covers the text input area and gets cut in height. and when keyboard is dismissed, the result is closer to what I want but it's still shorter in height. what I want to achieve is the blue area in the screenshots
activity_main:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/layout_main">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:id="@+id/h">
<ImageView
android:id="@+id/button_nav"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_alignParentStart="true"
android:scaleType="fitCenter"
android:src="@drawable/ic_menu_white_48dp"
android:layout_margin="16dp" />
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="68dp"
android:layout_gravity="center"
android:text="@string/app_name"
android:textAlignment="center" />
</RelativeLayout>
<androidx.drawerlayout.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/h"
tools:openDrawer="start">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_marginBottom="8dp"
android:gravity="bottom">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:dropDownHeight="match_parent"
android:id="@+id/edit_link_or_username"
android:inputType="text|textUri"
android:imeOptions="actionNext"
android:hint="@string/hint_enter_link_or_username" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp">
<ImageButton
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/button_confirm"
android:src="@drawable/ic_search_white_48dp"
android:visibility="visible"/>
<ProgressBar
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/progress_link_or_username"
android:visibility="invisible" />
</FrameLayout>
</LinearLayout>
<com.google.android.material.navigation.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer"
tools:visibility="gone" />
</androidx.drawerlayout.widget.DrawerLayout>
updated AutoCompleteTextView:
<androidx.appcompat.widget.AppCompatAutoCompleteTextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:id="@+id/edit_link_or_username"
android:inputType="textAutoComplete"
android:hint="@string/hint_enter_link_or_username" />
changed parent height:
android:layout_height="wrap_content"
added this code in OnCreate:
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)