java - Dynamically setting TextView with String.valueOf(intVar) truncates part of intVar -
i have textview starts @ '0' , updated on button press reflect current score total, public int points
. textview update, 1 or more of characters in score truncated (for instance, "1580" might display "158" or "15"). when activity completed , sent scoreboard activity, however, points shown correct (the variable passed on intent same variable points
).
here relevant java code:
public int points = 0; textview currentscorecounter = (textview) findviewbyid(r.id.scorecounter); currentscorecounter.settext(string.valueof(points));
and here scorecounter
in xml file:
<textview android:id="@+id/scorecounter" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0" android:textsize="30dp" android:layout_centerhorizontal="true" android:layout_alignparenttop="true" />
i suspect may have width/height of textview, unsure.
you use android:layout_weight=".60
cover 60% of width, sure set android:layout_width="0dp"
limited testing, works, same static size.
Comments
Post a Comment