2015-01-19 10 views
0

У меня есть макет, который выглядит как нижеКак добавить нижний колонтитул в этот макет?

Изображение TabName1 TabName2 TabName3 EditText

< -------------------- Tab Content ---- ------------------>

мне нужно добавить строку колонтитула ниже содержание вкладки, как показано ниже

Изображение TabName1 TabName2 TabName3 EditText

< -------------------- Содержимое вкладки ---------- --------------------

< -------------------- Нижний колонтитул ----------- ------------------->

Вот XML,

<?xml version="1.0" encoding="utf-8"?> 
    <TabHost xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@android:id/tabhost" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:orientation="vertical" > 

     <LinearLayout 
      android:id="@+id/tabs" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal" 
      android:padding="5dp" > 

      <ImageView 
       android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:layout_weight="1" 
       android:src="@drawable/ic_launcher" /> 

      <TabWidget 
       android:id="@android:id/tabs" 
       android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:layout_weight="1" 
       android:background="#F0F0F0" 
       android:showDividers="none" /> 

      <EditText 
       android:id="@+id/qsearch" 
       android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:layout_weight="1" 
       android:ellipsize="end" 
       android:imeOptions="actionSearch|flagNoExtractUi" 
       android:inputType="text" 
       android:lines="1" 
       android:maxLines="1" 
       android:scrollHorizontally="true" 
       android:singleLine="true" 
       android:text="sdfsf" > 

       <requestFocus /> 
      </EditText> 
     </LinearLayout> 

     <RelativeLayout 
      android:id="@+id/content" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      > 

      <FrameLayout 
       android:id="@android:id/tabcontent" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:padding="0dp" /> 

     </RelativeLayout> 
    </LinearLayout> 

</TabHost> 

Я попытался добавить LinearLayout с андроид: layout_alignParentBottom, но он не работает ,

ответ

0

Вы можете использовать LinearLayout вес, чтобы добиться этого, попробуйте следующее:

<?xml version="1.0" encoding="utf-8"?> 
<TabHost xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@android:id/tabhost" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:orientation="vertical" 
     android:padding="5dp" > 

     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/logo1" /> 

     <TabWidget 
      android:id="@android:id/tabs" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:background="#F0F0F0" 
      android:showDividers="none" /> 

     <FrameLayout 
      android:id="@android:id/tabcontent" 
      android:layout_width="fill_parent" 
      android:layout_height="0dp" 
      android:layout_weight="1" 
      android:padding="0dp" /> 

     <EditText 
      android:id="@+id/qsearch" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:ellipsize="end" 
      android:imeOptions="actionSearch|flagNoExtractUi" 
      android:inputType="text" 
      android:scrollHorizontally="true" 
      android:singleLine="true" > 

      <requestFocus /> 
     </EditText> 

     <LinearLayout 
      android:id="@+id/footer" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" > 
     </LinearLayout> 
    </LinearLayout> 

</TabHost> 
+0

Не работает. Нижний колонтитул будет сверху перекрывать верхнюю панель, и изображение логотипа и вкладки также исчезли. – Eddi

+0

Извините! Я просто обновил xml-вопрос. Случайно положил старый xml. – Eddi

0

Ok я решил его, добавив LinearLayout внутри RelativeLayout контента.

 <LinearLayout 
      android:id="@+id/footer" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:background="#FFFFFF" 
      android:orientation="horizontal" 
      android:layout_alignParentBottom="true"> 

     </LinearLayout>    
Смежные вопросы