GridLayout desired size is based on the children desired size when alignment is not Stretch.

Identation is now spaces instead of tabs.
This commit is contained in:
hshristov
2015-10-09 10:47:02 +03:00
parent 91bb8ce4a5
commit c3f28ba42d
6 changed files with 19 additions and 16 deletions

View File

@@ -700,13 +700,15 @@ class MeasureHelper {
this.columnStarValue = columnStarCount > 0 ? (this.width - currentColumnWidth) / columnStarCount : 0; this.columnStarValue = columnStarCount > 0 ? (this.width - currentColumnWidth) / columnStarCount : 0;
for(int i = 0; i < columnCount; i++) { if (this.stretchedHorizontally) {
for (int i = 0; i < columnCount; i++) {
ItemGroup item = this.columns.get(i); ItemGroup item = this.columns.get(i);
if (item.getIsStar()) { if (item.getIsStar()) {
item.length = item.rowOrColumn.getValue() * this.columnStarValue; item.length = item.rowOrColumn.getValue() * this.columnStarValue;
} }
} }
} }
}
private void fixRows() { private void fixRows() {
float currentRowHeight = 0; float currentRowHeight = 0;
@@ -725,13 +727,15 @@ class MeasureHelper {
this.rowStarValue = rowStarCount > 0 ? (this.height - currentRowHeight) / rowStarCount : 0; this.rowStarValue = rowStarCount > 0 ? (this.height - currentRowHeight) / rowStarCount : 0;
for(int i = 0; i < rowCount; i++) { if(this.stretchedVertically) {
for (int i = 0; i < rowCount; i++) {
ItemGroup item = this.rows.get(i); ItemGroup item = this.rows.get(i);
if (item.getIsStar()) { if (item.getIsStar()) {
item.length = item.rowOrColumn.getValue() * this.rowStarValue; item.length = item.rowOrColumn.getValue() * this.rowStarValue;
} }
} }
} }
}
private void fakeMeasure() { private void fakeMeasure() {
// Fake measure - measure all elements that have star rows and auto columns - with infinity Width and infinity Height // Fake measure - measure all elements that have star rows and auto columns - with infinity Width and infinity Height

View File

@@ -20,7 +20,6 @@ public abstract class LayoutBase extends ViewGroup {
super(context); super(context);
} }
@Override @Override
protected LayoutParams generateDefaultLayoutParams() { protected LayoutParams generateDefaultLayoutParams() {
return new CommonLayoutParams(); return new CommonLayoutParams();