RoShan Shan
RoShan Shan

Reputation: 2954

TextInput Layout not show floating text

I have problems with TextInputLayout, It does't show hint text above EditText when first load (having some texts in edittext) like this

enter image description here

I have problem when I use this lib https://github.com/braintree/android-card-form. Normally the TextInputLayout like this(when I have not added this lib yet). I don't know which style of this libs cause this problems(maybe it overrides some fields).

enter image description here

Thanks for help.

Upvotes: 0

Views: 527

Answers (2)

RoShan Shan
RoShan Shan

Reputation: 2954

I fixed this problem by changing in that library compile 'com.android.support:design:[25.0.0,26.0.0)' to compile 'com.android.support:design:25.0.1' And add to my project as a module .

This problem has the reason: I using appcompat-v7:25.0.1 but when I use gradle compile 'com.braintreepayments:card-form:3.0.3', the design support library changed to 25.1.0 and cause that problem. I changed to the same version of appcombat, desgin support librares.

Upvotes: 0

MezzDroid
MezzDroid

Reputation: 560

use this library it works fine for this purpose:

compile 'com.android.support:design:24.1.1'

Example:

 <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <EditText
                android:id="@+id/txtUsername"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:drawableLeft="@drawable/user"
                android:drawableTint="#FF4081"
                android:hint="User Name"
                android:inputType="textEmailAddress"
                android:maxLines="1" />
        </android.support.design.widget.TextInputLayout>

Upvotes: 1

Related Questions