AutoCompleteTextView Set Height to Fill Parent

there I am a newbie to Android Development, and learning it to my own! I just want my AutoCompleteTextView Drop Down height to be set to Fill the Parent.


My AutoCompleteTextView View in XML is:

  <AutoCompleteTextView
    android:id="@+id/countries_list"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="@dimen/_20sdp"
    android:dropDownHeight="match_parent"
    android:ems="10">
</AutoCompleteTextView>

I am also attaching a screenshot that shows the green part of the drop down filling just a part of the parent, but I want it to fill the parent by its height. I don't know if its possible or not? Can somebody figure me out for the possibility?


DropDown not filling the parent by its Height


For an extra info I am adding the complete Layout here:

 <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <AutoCompleteTextView
        android:id="@+id/countries_list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="@dimen/_20sdp"
        android:dropDownHeight="match_parent"
        android:ems="10">
    </AutoCompleteTextView>

    <RelativeLayout
        android:id="@+id/revealLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginBottom="?android:attr/actionBarSize"
        android:animateLayoutChanges="true"
        android:background="#00FFA9"
        android:visibility="gone">

        <TextView
            android:id="@+id/textReveal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:text="Hello Reveal!"
            android:textColor="#000000"
            android:textSize="@dimen/_24ssp"/>
    </RelativeLayout>
</RelativeLayout>

2 answers

  • answered 2018-05-16 05:57 sasikumar

    Set height as match_parent in AutoCompleteTextView

    <AutoCompleteTextView
    android:id="@+id/countries_list"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="@dimen/_20sdp"
    android:dropDownHeight="match_parent"
    android:ems="10">
    

  • answered 2018-05-16 13:24 kundan kamal

    If you are using in android:dropDownHeight="match_parent" then it will works after API 8 not less to it.unles you put fixed value like 200dp or 300dp.