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?
Asked
Active
Viewed 4,446 times
2
-
Probably you want this: TextView.getTextSize() – Bruno Ferreira Aug 02 '17 at 08:02
-
I think, this should help you. https://stackoverflow.com/questions/3139676/android-edittext-hint-size – Bhavik Mehta Aug 02 '17 at 08:02
-
You can get hint size of EditText and Set as well which is equivalent to hint text size. – AndroidLad Aug 02 '17 at 08:03
-
Do you want to give size floating hint ? – Rohit Singh Aug 02 '17 at 08:03
2 Answers
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