nourdine
nourdine

Reputation: 7597

background of a LinearLayout covering its content

I have this markup:

<LinearLayout
   android:id="@+id/authorDetails"
   style="@style/authorDetails">

<ImageView  
   android:id="@+id/authorPic"
   style="@style/authorPic" />   

<TextView  
   android:id="@+id/authorName"
   style="@style/authorName"
   android:text="author name" />

</LinearLayout>

and this style:

 <style name="authorDetails">
      <item name="android:layout_below">@id/header</item>
      <item name="android:layout_width">fill_parent</item>
      <item name="android:layout_height">89dip</item>
      <item name="android:orientation">horizontal</item>      
      <item name="android:background">@drawable/bg</item>        
   </style>  

   <style name="authorPic">
      <item name="android:layout_width">wrap_content</item>
      <item name="android:layout_height">wrap_content</item>
      <item name="android:src">@drawable/xxx</item>
   </style>

   <style name="authorName">
      <item name="android:layout_width">wrap_content</item>
      <item name="android:layout_height">wrap_content</item>
   </style>     

and u know what?

the background of the LinearLayout covers the content (ImageView and TextView). Why is that? I dont get it! if I take out the declaration about the LinearLayout bg the content re-appears.

help please!

Upvotes: 1

Views: 287

Answers (1)

cosminm
cosminm

Reputation: 33

I have also came across this issue and although this question has asked a long time ago I'm posting this response as it may help someone who reads this thread. From what I saw in my case the problem was caused by a 9patch image which I was using as a background. In 'nourdine' case it might be that the '@drawable/bg' file is a 9patch one. Using a plain image should solve the issue.

Upvotes: 1

Related Questions