Reputation: 117
In my layout I am using EditText
inside TextInputLayout
so 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:textSize
attribute?
Upvotes: 3
Views: 4721
Reputation: 233
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
Upvotes: 1
Reputation: 8237
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);
Upvotes: 2