tags:

views:

12

answers:

1

I have a simple LinearLayout. When I add the android:background to the LinearLayout, the TextView is no longer visible.

What am I not understanding?

<LinearLayout 
   android:id="@+id/LinearLayout01" 
   android:layout_width="fill_parent" 
   android:layout_height="53px"
   android:background="@drawable/glossy_black_top_bar"
   >

       <TextView android:text="This is the Title" 
       android:id="@+id/TextView01" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content"
       android:gravity="center_vertical"
       android:textColor="#FFFFFF">
       </TextView>
</LinearLayout>
A: 

It seems that LinearLayouts with backgrounds expand wierdly. I just used a Framelayout to create a header. Here's the XML if anyone wants I. It takes an ImageView that points to a NinePatched background and stretches it.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:orientation="vertical"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent">

<FrameLayout 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

     <ImageView android:id="@+id/ImageView01" 
         android:layout_width="fill_parent" 
         android:layout_height="wrap_content"
         android:src="@drawable/glossy_black_top_bar"
         android:layout_alignParentTop="true"
         android:scaleType="fitXY">
     </ImageView>

    <LinearLayout 
           android:id="@+id/LinearLayout01" 
           android:layout_width="fill_parent" 
           android:layout_height="wrap_content" 
           android:orientation="horizontal">

             <TextView android:text="MY HEADER TITLE" 
             style="@style/title"
               android:id="@+id/TextView01" 
               android:layout_width="fill_parent" 
               android:layout_height="wrap_content"
               android:gravity="center"
               android:layout_gravity="center"
               android:shadowColor="#000000"
               android:shadowRadius=".5"
               android:shadowDx="-.5"
               android:shadowDy="-.5"
               android:paddingTop="5dip">
               </TextView>
    </LinearLayout>
</FrameLayout>

<WebView android:id="@+id/WebView01" android:layout_width="fill_parent" android:layout_height="fill_parent"></WebView> 

</LinearLayout>
BahaiResearch.com