I've been trying to center this custom view I have inside this other custom View that extends LinearLayout. This all needs to be done via code because it's all done at runtime.
I've tried the standard approach with setting the gravity:
this.setGravity(Gravity.CENTER);
That was done inside of my class that extends LinearLayout.
I've also tried the LayoutParams method:
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
params.gravity = Gravity.CENTER;
block.setLayoutParams(params);
this.addView(block);
This was done in the place where I add the block to the view (as you can see).
Both methods resulted in the block still being aligned in the upper-left hand corner of my view. What are my other options or, more importantly, what in the world am I doing wrong?