I have a LinearLayout (holder), which has match_parent for both width and height. In this holder I insert a View (a Class extending View). I do this inside the onCreate method of the Activity.
My question is, how do I make this child View stretch maximum horizontally and vertically, keeping a square shape, to fill as much area as possible from the parent LinearLayout?
Here’s what I use right now as a starting point:
pieContainer = (LinearLayout) findViewById(R.id.pie_container_id);
pie = new PieView(this);
pieContainer.addView(pie);
I have tried playing around with overwriting the onMeasure method on both sides (the main activity and the PieView class), but to no avail.
Try this custom SquareView