How can I set one layout components height to the same as another component: example: Can I set android:layout_height="@+id/info_box.height" or do something similar?
I want the height of the ImageView to match that of my LinearLayout
ImageView android:id="@+id/border"
android:src="@drawable/frame"
android:layout_below="@+id/title"
android:layout_width="fill_parent"
android:layout_height="????"
android:scaleType="fitXY"
android:drawingCacheQuality="auto"
/>
<LinearLayout
android:id="@+id/info_box"
android:orientation="vertical"
android:layout_below="@+id/title"
android:background="@layout/my_bg"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
... other stuff . .
</LinearLayout>
The only way to achieve this is to have the two views be part of the same container. A LinearLayout or RelativeLayout are usually well suited for this. You could also achieve this through code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With