开发者

Keep Buttons at bottom of layout visible when list is long

I have a layout that is three linear layouts. The top has some icons and the middle has a tabhost. Each tabhost has a list inside it. The bottom linearlayout has two buttons that should stay at the bottom on the screen at all times. The problem is when a list in the tabhost gets too long, it displays over the buttons. I tried to find some way to get the buttons to bedisplayed over the list but have failed so far. Any help would be appreciated. :-) Thanks!

<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" 
开发者_如何学Go                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>


I generally put my LinearLayouts inside of a ScrollView to solve this situation. (The buttons stay outside) It allows your buttons to stay in the correct location at all times and the user scroll the rest of the view.

ScrollView Docs

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜