Seeing that you're limiting the width of your LinearLayout
by the width of your image, you can set its width to the same, which should help. This allows the measure pass (I believe) to "better" define all the measure constraints/rules.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/company_card_layout"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/category_logo"
android:layout_width="120dp"
android:layout_height="96dp"
android:layout_gravity="center_horizontal"
android:scaleType="centerCrop"
android:src="@drawable/my_drawable" />
<TextView
android:id="@+id/category_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="This is a very long text and should take at least 2 lines" />
</LinearLayout>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…