Держите кнопки в нижней части макета видимыми, когда список длинный - PullRequest
1 голос
/ 07 сентября 2010

У меня есть макет, который состоит из трех линейных макетов.В верхней части есть несколько значков, а в средней - табос.Каждый вкладка имеет список внутри.Нижнее линейное расположение имеет две кнопки, которые должны всегда оставаться внизу экрана.Проблема в том, что когда список в tabhost становится слишком длинным, он отображается поверх кнопок.Я пытался найти способ заставить кнопки показываться поверх списка, но пока не получилось.Любая помощь будет оценена.:-) Спасибо!

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <TabHost 
        android:id="@android:id/tabhost"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content">
        <LinearLayout 
            android:orientation="vertical"
            android:layout_width="fill_parent" 
            android:layout_height="395dp"
            android:background="#000000">
            <TabWidget 
                android:id="@android:id/tabs"
                android:layout_width="fill_parent" 
                android:layout_height="wrap_content" 
            />
            <FrameLayout 
                android:id="@android:id/tabcontent"
                android:layout_width="fill_parent" 
                android:layout_height="wrap_content"
                android:padding="5dp" 
            />
        </LinearLayout>
    </TabHost>
</LinearLayout>

<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" 
android:layout_width="fill_parent"
android:layout_height="fill_parent" 
android:gravity="fill"
android:layout_margin="0dp" 
android:padding="0dp" 
>
<Button 
    android:id="@+id/btnGroup" 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" 
    android:text="Ptt" 
    android:layout_gravity="bottom" 
    android:layout_weight="2"
    android:hapticFeedbackEnabled="true"/>
<Button 
    android:id="@+id/btnMenu" 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" 
    android:text="Menu" 
    android:layout_gravity="bottom"
    android:layout_weight="2" 
    android:hapticFeedbackEnabled="true"/>
</LinearLayout>

1 Ответ

0 голосов
/ 07 сентября 2010

Я обычно помещаю свои LinearLayout в ScrollView, чтобы решить эту ситуацию. (Кнопки остаются снаружи). Это позволяет вашим кнопкам всегда оставаться в правильном положении, и пользователь прокручивает оставшуюся часть просмотра.

Документы ScrollView

...