Apply seemless gradient across rows in Android TableLayout -


i working list view customer arrayadapter. have overridden getview update text views in tablelayout. after updating text gradient applied group of table rows dynamically highlight relevant information @ given time. unfortunately highlighting not appear exept. expected appearance follows:

correct appearance

however, @ startup , if click on list item appearance changes:

incorrect appearance

and there space visible between gradient applied each table row. theory row height changing when text modified, gradient size being calculated prior redraw. when rows redrawn same text appear correct (since row height didn't change).

i'm looking suggestion resolve issue, preferably setting make table behave way want or api call size of rows recalculated prior applying gradient. alternatively better technique produce more reliable behavior.

i have tried invalidating whole table , individual rows prior applying gradient. had no effect.

the code draws gradient follows:

    tablerow travelinforow = (tablerow) v.findviewbyid(r.id.travelinfo);     tablerow arrivalinforow = (tablerow) v.findviewbyid(r.id.arrivalinfo);     tablerow destinationinforow = (tablerow) v.findviewbyid(r.id.destinationinfo);     tablerow departureinforow = (tablerow) v.findviewbyid(r.id.departureinfo);      gradientdrawable gd = new gradientdrawable(gradientdrawable.orientation.left_right, new int[] { 0xff0b4496, 0xff000000 });      if (item.enroute()) {         travelinforow.setbackgrounddrawable(gd);     } else {         travelinforow.setbackgroundcolor(color.black);     }      if (item.atlocation()) {         arrivalinforow.setbackgrounddrawable(gd);         destinationinforow.setbackgrounddrawable(gd);         departureinforow.setbackgrounddrawable(gd);     } else {         arrivalinforow.setbackgroundcolor(color.black);         destinationinforow.setbackgroundcolor(color.black);         departureinforow.setbackgroundcolor(color.black);     } 


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -