CheckedTextView takes up more space than TextView

I have two TableLayouts next to each other. They display similar information, so the corresponding lines should be next to each other. That is, the row three of the left table should be aligned horizontally with the third row of the right table. (I use two tables, so I can get a vertical line between them, as well as some other reasons that make the code more organized.) When I started, both tables used TextViews in TableRows to display the data and everything that was well organized. Now I need the table on the right to have checkmarks next to the cells in the TableRows to show that they were completed, so in the right table I switched from TextViews to CheckedTextViews, which works very well, except that they have a lot more spaces between the rows than the table on the left,which still uses TextViews. I tried setting the registration to zero for CheckedTextView and its drawable, but this seems to have no effect.

Here is the style that I apply to my CheckedTextViews:

<style name="Check" >
  <item name="android:layout_height">wrap_content</item>
  <item name="android:layout_width">wrap_content</item>
  <item name="android:gravity">center_vertical|left</item>
  <item name="android:drawablePadding">0dp</item>
  <item name="android:padding">0dp</item>
  <item name="android:checkMark">?android:attr/listChoiceIndicatorMultiple</item>
</style> 

Here is an example row from my TableLayout:

<TableRow>
  <CheckedTextView 
    android:id="@+id/j_elective_01"
    style="@style/Check"/>

  <CheckedTextView 
    android:id="@+id/j_elective_02"
    style="@style/Check"/>
</TableRow>

I considered the possibility that the icon used for the checkbox has many built-in spaces, I looked at checkbox_on_background.png and checkbox_off_background.png in ... platform / android-12 / data / res / drawable -hdpi /, and it seems to be , not this way.

I want to not add an addition to the left table of entries in the row, because I do not want to waste screen space. I just want to find a way to get rid of some space between the rows in the right table.

+3
source share
1 answer

Resize the checkbox so that it does not take up more space than your text:

android-how-to-change-checkbox-size

0
source

All Articles