2

In my layout I am using EditText inside TextInputLayoutso I can have floating hint. Right now I would like to create some TextViews which sizes are equal to that of floating hint. But how can I know the right size value? Is it somehow determinant of a EditText's android:textSizeattribute?

AskNilesh
  • 67,701
  • 16
  • 123
  • 163
YesPapa
  • 97
  • 2
  • 10

2 Answers2

2

You can do like this.

change EditText's text size

android:textSize="12sp"

You can do this in the .java.

editText.setTextSize(12);

change TextInputLayout's LEFT-TOP text size

app:hintTextAppearance="@style/text_in_layout_hint_Style"

style code

<style name="text_in_layout_hint_Style">
    <item name="android:textColor">#FF0000</item>
    <item name="android:textSize">20sp</item>
</style>

You can do this in .java.

textInputLayout.setHintTextAppearance(R.style.text_in_layout_hint_Style);
KeLiuyue
  • 8,149
  • 4
  • 25
  • 42
1

you can set it via styles

create HintTextAppearance style with

<item name="android:textSize">Your text size</item>

and set app:hintTextAppearance="@style/Your style" to your InputTextLayout

Olena Y
  • 233
  • 2
  • 8
  • That is the size of EditText text size. I want size of floating hint which is small text over EditText when you start to type something – YesPapa Aug 02 '17 at 08:19