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,6 +700,7 @@ class MeasureHelper {
this.columnStarValue = columnStarCount > 0 ? (this.width - currentColumnWidth) / columnStarCount : 0; this.columnStarValue = columnStarCount > 0 ? (this.width - currentColumnWidth) / columnStarCount : 0;
if (this.stretchedHorizontally) {
for (int i = 0; i < columnCount; i++) { 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()) {
@@ -707,6 +708,7 @@ class MeasureHelper {
} }
} }
} }
}
private void fixRows() { private void fixRows() {
float currentRowHeight = 0; float currentRowHeight = 0;
@@ -725,6 +727,7 @@ class MeasureHelper {
this.rowStarValue = rowStarCount > 0 ? (this.height - currentRowHeight) / rowStarCount : 0; this.rowStarValue = rowStarCount > 0 ? (this.height - currentRowHeight) / rowStarCount : 0;
if(this.stretchedVertically) {
for (int i = 0; i < rowCount; i++) { 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()) {
@@ -732,6 +735,7 @@ class MeasureHelper {
} }
} }
} }
}
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();