florent37 / MaterialTextField

A different beautiful Floating Edit Text
Apache License 2.0
1.49k stars 240 forks source link

BUG: get focus when a layout is placed below #40

Open CyrilNb opened 6 years ago

CyrilNb commented 6 years ago

Hi,

I'd like to report a bug when the MaterialTextField is placed above a RecyclerView or Gridview. On the display of the activity, the keyboard is opened automatically, without editText getting the focus. That's a very weird behaviour.

But only with a layout below. It doesn't occur with a simple TextView or button below your MaterialEditText.

This is my current XML: <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" android:orientation="horizontal" android:paddingEnd="5dp" android:paddingStart="5dp">

        <com.github.florent37.materialtextfield.MaterialTextField
            android:id="@+id/materialTxtField"
            android:layout_width="291dp"
            android:layout_height="wrap_content"

            android:layout_gravity="bottom|center_vertical|center_horizontal"
            android:layout_weight="1"
            app:mtf_animationDuration="250"
            app:mtf_cardCollapsedHeight="4dp"
            app:mtf_image="@drawable/gold_star_icon"
            app:mtf_labelColor="@color/colorPrimaryLight"
            app:mtf_openKeyboardOnFocus="true">

            <EditText
                android:id="@+id/editTxtPlayerName"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/player_name"
                android:inputType="none" />

        </com.github.florent37.materialtextfield.MaterialTextField>

        <ImageButton
            android:id="@+id/btnRetrieveTime"
            android:layout_width="77dp"
            android:layout_height="55dp"
            android:layout_gravity="bottom"
            android:layout_marginStart="5dp"
            android:layout_weight="1"
            android:adjustViewBounds="true"
            android:background="@drawable/roundedcorner"
            android:contentDescription="@string/btnGetTime"
            android:padding="2dp"
            android:scaleType="fitCenter"
            android:src="@drawable/ic_chrono2" />
    </LinearLayout>

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginBottom="10dp"
        android:layout_marginEnd="20dp"
        android:layout_marginStart="20dp"
        android:layout_marginTop="50dp"
        android:animationCache="false"
        android:layoutAnimation="@anim/layout_animation_fall_down"
        android:scrollbars="none" />

Could you help me please ?

AmineMessabhia commented 6 years ago

Yes please, i have the same problem, @florent37 anything we can do about this?