VAle, here I bring the solution after two days, it has cost me, but it has been perfect, as indicated in a comment above, it is necessary to do it programmatically:
The first thing was to create this class that extends from ImageView:
public class SquareImageView extends ImageView {
public SquareImageView(Context context) {
super(context);
}
public SquareImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SquareImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, widthMeasureSpec);
int width = getMeasuredWidth();
setMeasuredDimension(width, width);
}
}
Now that we have this, we only have the layout, as you will see, it is not exactly like the one above, because although for API > 21 worked, due to a parameter below the API 21 the icons disappeared.
I leave here the new layout:
<TableLayout
android:background="@drawable/corners_main_layout"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="@dimen/padding_white"
android:layout_marginEnd="@dimen/padding_white"
android:layout_marginLeft="@dimen/padding_white"
android:layout_marginRight="@dimen/padding_white"
android:layout_marginTop="@dimen/padding_white"
android:id="@+id/constraintLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="*"
android:shrinkColumns="0,1,2" >
<TableRow
android:id="@+id/columna1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="0dp"
android:orientation="vertical"
android:id="@+id/linearLayout3"
android:paddingLeft="25dp"
android:paddingTop="25dp">
<....Utils.SquareImageView
android:src="@drawable/ic_info"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitXY"
android:background="@drawable/shadow_custom" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:textColor="@android:color/black"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="0dp"
android:orientation="vertical"
android:id="@+id/linearLayout"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:paddingTop="25dp">
<....Utils.SquareImageView
android:src="@drawable/ic_skinav"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitXY"
android:background="@drawable/shadow_custom" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:textColor="@android:color/black"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="0dp"
android:orientation="vertical"
android:id="@+id/linearLayout9"
android:layout_marginRight="25dp"
android:layout_marginTop="25dp">
<......Utils.SquareImageView
android:src="@drawable/ic_social"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitXY"
android:background="@drawable/shadow_custom" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:textColor="@android:color/black"
android:textSize="16sp" />
</LinearLayout>
</TableRow>
<TableRow
android:id="@+id/columna2"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="0dp"
android:orientation="vertical"
android:id="@+id/linearLayout8"
android:layout_marginLeft="25dp"
android:paddingTop="25dp">
<.......Utils.SquareImageView
android:src="@drawable/ic_stats"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitXY"
android:background="@drawable/shadow_custom" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:textColor="@android:color/black"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="0dp"
android:orientation="vertical"
android:id="@+id/linearLayout10"
android:paddingLeft="25dp"
android:paddingRight="25dp"
android:paddingTop="25dp">
<..............Utils.SquareImageView
android:src="@drawable/ic_alerts"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitXY"
android:background="@drawable/shadow_custom" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:textColor="@android:color/black"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="0dp"
android:orientation="vertical"
android:id="@+id/linearLayout2"
android:paddingBottom="25dp"
android:paddingRight="25dp"
android:paddingTop="25dp">
<......Utils.SquareImageView
android:src="@drawable/ic_inbox"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitXY"
android:id="@+id/idinbox"
android:background="@drawable/shadow_custom" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/inbox"
android:layout_gravity="center"
android:textColor="@android:color/black"
android:textSize="16sp" />
</LinearLayout>
</TableRow>
</TableLayout>
And that's it, with this it works for all the APIs and resizes the images perfectly