I'm working on a custom view that uses a GridLayout from the support library on Android. I've set app:columnCount="7"
on the GridLayout. At runtime, I populate it with TextViews. Each of those has width/height of wrap_content and app:layout_columnWeight="1"
. The TextViews are setup in their onMeasure() to have the same width/height (Math.max(getMeasuredWidth(), getMeasuredHeight())
).
What I end up with are 5 columns that are 133px and 2 columns that are 163px on a Nexus 5X instead of 7 columns that are each about 142px. For the life of me, I can't figure out why those 2 columns are so much larger and how to fix it.
Can anyone clue me in here?
Environment is:
Android Studio 2.3
Gradle Plugin 2.3.2
Gradle 3.4.1
Nexus 5X
Android O Preview 2 (though I've seen the same issue on Android 7.1.2)