Size LinearLayout to the Width of ImageView

view story

http://stackoverflow.com – In my Fragment XML i have an imageview which functions as a background. In that same layout i got a LinearLayout which holds some buttons that should be viewed horizontally on the view and have the same width as the background. My code sizes it to the width of the screen because of wrap_content. How can I size it to the imageview? <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_horizontal" android:layout_marginTop="45sp" > <ImageView an (HowTos)