by on_and_off · 2y ago · 0 comments
>"to just show text" is such a tell that you know nothing about UI
I have actually made my own TextView using just layout so I don't think this comment is warranted.
[0] https://cs.android.com/android/platform/superproject/main/+/...
Make sure you handle the following attributes and how they affect each other!
> text, bufferType, hint, textColor, textColorHighlight, textColorHint, textAppearance, textColorLink, textFontWeight, textSize, textScaleX, fontFamily, typeface, textStyle, cursorVisible, maxLines, maxHeight, lines, height, minLines, minHeight, maxEms, maxWidth, ems, width, minEms, minWidth, gravity, scrollHorizontally, password, singleLine, selectAllOnFocus, includeFontPadding, maxLength, shadowColor, shadowDx, shadowDy, shadowRadius, autoLink, linksClickable, numeric, digits, phoneNumber, inputMethod, capitalize, autoText, editable, freezesText, ellipsize, drawableTop, drawableBottom, drawableRight, drawableLeft, drawableStart, drawableEnd, drawablePadding, drawableTint, drawableTintMode, lineSpacingExtra, lineSpacingMultiplier, justificationMode, marqueeRepeatLimit, inputType, imeOptions, privateImeOptions, imeActionLabel, imeActionId, editorExtras, elegantTextHeight, fallbackLineSpacing, letterSpacing, fontFeatureSettings, fontVariationSettings, breakStrategy, hyphenationFrequency, lineBreakStyle, lineBreakWordStyle, autoSizeTextType, autoSizeMinTextSize, autoSizeMaxTextSize, autoSizeStepGranularity, autoSizePresetSizes, textCursorDrawable, textSelectHandle, textSelectHandleLeft, textSelectHandleRight, allowUndo, enabled
Done
>textColor, typeface, textColorLink, textFontWeight, textStyle
handled by TextPaint in StaticLayout/DynamicLayout. For example textColorLink is just `linkColor` from TextPaint.[0]
>text, textSize, maxLines, justificationMode, breakStrategy, hyphenationFrequency, lineBreakStyle
handled by StaticLayout/DynamicLayout
>shadowColor, shadowDx, shadowDy, shadowRadius
mTextPaint.setShadowLayer(radius, dx, dy, color);
Wow, that was so difficult. Only those that "know about UI" must be capable of such a feat?
>numeric, digits, phoneNumber, inputMethod, editable, cursorVisible, textCursorDrawable, allowUndo, inputType, imeOptions, privateImeOptions, imeActionLabel, imeActionId, editorExtras,
Only needed if you add a text editor into your text view, which I did not do.
I'm not going to go through all of these because I'm not sure exactly which side implements them (for example elegantTextHeight sound like something TextView does, but I'm not sure.) I suggest you actually sit down to read TextView before you make comments about it.
[0] https://developer.android.com/reference/android/text/TextPai...
> I'm not going to go through all of these because I'm not sure exactly which side implements them (for example elegantTextHeight sound like something TextView does, but I'm not sure.) I suggest you actually sit down to read TextView before you make comments about it.
Which is exactly my damn point, you expect your case to be the only one used. They have to think about EVERYONE and their use cases and how everything interacts.
Have you handled LTR text correctly, custom unicode in fonts, weird alignment issues due to accent marks?
My guess would be no, simply because you never thought of them.