Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TextInputLayout counter to the top

The TextInputLayout introduces a nice counter function in the support-library version 23.1.0 - unfortunately with the floating-hint this gets very high in layout_height. Is there a way to bring the counter to the top ( on the same height as the floating-label? )

like image 318
ligi Avatar asked Oct 16 '15 13:10

ligi


People also ask

How do you make TextInputLayout clickable?

Set TextInputLayout android:clickable="true" . Set TextInputEditText android:clickable="true" and android:focusable="false" .

What is TextInputEditText?

↳ com.google.android.material.textfield.TextInputEditText. A special sub-class of EditText designed for use as a child of TextInputLayout . Using this class allows us to display a hint in the IME when in 'extract' mode and provides accessibility support for TextInputLayout .

What is a TextInputLayout?

Android TexInputLayout extends LinearLayout. The primary use of a TextInputLayout is to act as a wrapper for EditText(or its descendant) and enable floating hint animations. Rule of Thumb : TextInputLayout should wrap TextInputEditText instead of the normal EditText.


1 Answers

Currently you can't do it.

The TextInputLayout follows the material guide line and the counter is on the bottom.
Checking the code you can only customize these specs:

  • enable counter also available with xml attribute android.support.design:counterEnabled

  • The counter max lenght also available with xml attribute app:counterMaxLength. (this attr is not currently in the official doc. You can check this post)

enter image description here

like image 183
Gabriele Mariotti Avatar answered Oct 13 '22 18:10

Gabriele Mariotti