Android ScrollView doesn’t start at top, but at the beginning of the GridView

Solution: Ok sorry if it is a late reply but I stumbled upon the same issue (only that I was using ListView instead) and with a bit of trial and error I found the solution to this: Basically the problem lies in the fact that the GridView/ListView child automatically requests parent focus (ScrollView) when you … Read more

Get rid of ugly if statements

How about such approach: int getSize(int v) { int[] thresholds = {145, 117, 68, 51, 22, 10}; for (int i = 0; i < thresholds.length; i++) { if (v > thresholds[i]) return i+1; } return 1; } Functionally: (Demonstrated in Scala) def getSize(v: Int): Int = { val thresholds = Vector(145, 117, 68, 51, 22, … Read more