Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing background of LinearLayout changes it's width & height

I tried to change background of a LinearLayout to some wood texture, but it changes LinearLayout width and height depending on dimensions of the wooden background! I need LinearLayout to disregard background dimensions!

<LinearLayout
  android:id="@+id/LinearLayout1"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:background="@drawable/wood"
  android:orientation="vertical" >

some content here which I need to wrap height to them!

</LinearLayout>
like image 803
AVEbrahimi Avatar asked Apr 28 '26 09:04

AVEbrahimi


1 Answers

Your LinearLayout's height is "wrap_content". Which means it takes height of the content(your background). You can change it to "match_parent" or give it a fixed size in dp. So that it remains same even with background.

like image 98
Seshu Vinay Avatar answered Apr 30 '26 22:04

Seshu Vinay