I have a table with 3 rows of numbers (summary). When TextViews are styled by default, the text is displayed correctly.

But when they are styled with <item name="android:gravity">right</item> , each TextView shows only the first character of what it should.

It even includes column headings - not shown here - that I donβt even change.
I would like the table values ββto be right-aligned to be compatible with the rest of the application, and I am at a dead end why the values ββin the table will behave as follows.
Here's my style (when it doesn't work):
<style name="summary_values"> <item name="android:textSize">@dimen/font_size</item> <item name="android:textStyle">bold</item> <item name="android:textColor">@color/background</item> <item name="android:gravity">right</item> </style>
Here's the XML for one of the cells (they are all basically the same)
<TextView android:id="@+id/value1" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="@integer/table_weight_percent_value" style="@style/summary_values"/>
Edit
Truncation occurs even when gravity set to left or center .
Edit 2
I removed the line <item name="android:gravity">right</item> from the style as a whole, and it still truncates sometimes, depending on the values. I went through my code and the values ββin the code are correct.
Edit 3
After deleting the whole style except the font color, truncation still occurs, but I did not understand when. If I change the numbers in the input table, the summary values ββare sometimes truncated, and sometimes not.
Here is a row from the table. All lines are similar, except for identifier changes.
<TableRow android:padding="@dimen/pad_12"> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="@integer/table_weight_percent_label" android:text="@string/cho" style="@style/label_light"/> <TextView android:id="@+id/percent_1" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="@integer/table_weight_percent_value" style="@style/summary_values"/> <TextView android:id="@+id/val1a" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="@integer/table_weight_percent_value" style="@style/summary_values"/> <TextView android:id="@+id/val1b" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="@integer/table_weight_percent_value" style="@style/summary_values"/> </TableRow>
Change 4
After trying a few things, I changed the contents of the TableView to a LinearLayout with a horizontal orientation. I even left the TableRow as they were (just adding layout_width and layout_height). Surprisingly, now it works.
To describe the odd behavior a little more: when it showed only the first character, if I opened the soft keyboard and closed it again, the table will display correctly until I change one of the EditText values. It still behaved in such a strange way, even when I deleted 2 columns from the table, so there was enough room for the views.