I've got an idea you could try creating a custom view to draw this instead of using views.
Extend the View class in a new class and override the onDraw method.
//variables
Paint paint[]; //Set up these paints with the colors you need
int rowWidth, int colHeight;
void onDraw(Canvas c){
for(int i=0;i<noOfRows;i++){
for(int j=0;j<noOfColumns;j++){
if(cellRequired(i,j)){
//cellRequired will be whatever logic you have to check if cell is required
int rectHeight=colHeight; //Now the Rect Height changes whether the cell
// below is in use or not.
for(int k=i;k<noOfRows;k++){
//This loop will run through the rows and see if merging is required
if(cellRequired(i,k))
rectHeight+=colHeight; //Merge Cell
else
break; //If not required at any point break loop
}
//Draw Rectangle background
c.drawRect(i*rowWidth +i, j*colHeight +j, rowWidth, rectHeight, backPaint);
//Draw Text
canvas.drawText("Text",i*rowWidth +i, j*colHeight +j, paint[requiredPaint]);
//I added the plus i and plus j so there'd be a gap in the rectangles
// Then it will be a border
}
}
}
}
Android documentation on custom controls
you
Android: Tutorial on Custom View creation
How to make a custom view similar to above
http://www.droidnova.com/playing-with-graphics-in-android-part-i,147.html
Go through these and then through the code above. Hopefully it should show you how to implement it.