2010-08-01 2 views
0

У меня есть простой LinearLayout. Когда я добавляю андроид: фон к LinearLayout, TextView больше не виден.Фон Android скрывает текст для просмотра детей

Что я не понимаю?

<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> 

ответ

2

Кажется, что LinearLayouts с фоном расширяются странно. Я просто использовал Framelayout для создания заголовка. Вот XML, если кто-то хочет I. Требуется ImageView, который указывает на фон NinePatched и растягивает его.

<?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> 
Смежные вопросы