android:fix android textview truncate problem

This commit is contained in:
刘涛 2020-04-14 20:22:39 +08:00 committed by osborn
parent 9e0b3e067b
commit c329cfcf53

View File

@ -48,6 +48,7 @@ public class TextNode extends ViewNode<TextView> {
TextView tv = new TextView(getContext()); TextView tv = new TextView(getContext());
tv.setGravity(Gravity.CENTER); tv.setGravity(Gravity.CENTER);
tv.setMaxLines(1); tv.setMaxLines(1);
tv.setSingleLine(true);
tv.setEllipsize(TextUtils.TruncateAt.END); tv.setEllipsize(TextUtils.TruncateAt.END);
tv.setIncludeFontPadding(false); tv.setIncludeFontPadding(false);
return tv; return tv;
@ -98,6 +99,7 @@ public class TextNode extends ViewNode<TextView> {
if (line <= 0) { if (line <= 0) {
line = Integer.MAX_VALUE; line = Integer.MAX_VALUE;
} }
view.setSingleLine(line == 1);
view.setMaxLines(line); view.setMaxLines(line);
break; break;
case "fontStyle": case "fontStyle":