The length of hint in my EditText is bit longer than the width of ET view. So how can i set marquee attribute to ET view. I have tried setting it, but the app crashes giving the error : E/AndroidRuntime(2095): Caused by: java.lang.IllegalArgumentException: EditText cannot use the ellipsize mode TextUtils.TruncateAt.MARQUEE
I have gone through the docs of ellipsize method, but not getting what i am supposed to do.I have tried these two steps :
1)
android:maxLines="1"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
2) android:maxLines="1"
android:scrollHorizontally="true"
Docs of ellipsize method: Causes words in the text that are longer than the view is wide to be ellipsized instead of broken in the middle. You may also want to setSingleLine() or setHorizontallyScrolling(boolean) to constrain the text to a single line. Use null to turn off ellipsizing. If setMaxLines(int) has been used to set two or more lines, only END and MARQUEE are supported (other ellipsizing types will not do anything).
Let me know what modification has to be done so that it works right.Thank you
@DJphy - I found a solution no need to set ellipsis. when you are setting the string to edit text just set simple HTML attributes to string.
Played with some HTML tricks and it worked for me.
ex:-
nameEdittxt.setHint(Html.fromHtml("<small><small><small>" + getString(R.string.enter_name) + "</small></small></small>"
));
This will help to set hint smaller and Edit text size as normal you had set as fontsize. Look at my attachments - Before setting HTML attributes to hint -
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With