android 关于底部控件遮挡上面list控件的解决办法

来源:互联网 发布:mac系统打符号 编辑:程序博客网 时间:2024/06/05 19:15

如题,这段时间遇到了这样的问题

如图:


这是由于,我们只在下面的控件中加入了:android:layout_alignParentBottom="true"

如:

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

<!--这个linerLayout中会产生list-->
        <LinearLayout
            android:id="@+id/tab_liner"
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:gravity="clip_vertical"
            android:padding="5dp"
            >
            <TabWidget android:id="@android:id/tabs"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                ></TabWidget>

            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="fill_parent"
                android:layout_height="match_parent"
                android:padding="5dp" >
            </FrameLayout>
    
        </LinearLayout>
        <RelativeLayout
            android:id="@+id/tabButtomButtons"
            android:layout_width="fill_parent"
            android:layout_height="100dp"
            android:layout_alignParentBottom="true"
            android:background="@color/black_overlay"
            android:padding="5dp"
            >
        </RelativeLayout>
     </RelativeLayout>
</TabHost>
将上面的改为:

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@android:id/tabhost"
    >
    <RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="5dp" >
        <LinearLayout
            android:id="@+id/tab_liner"
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:gravity="clip_vertical"
            android:layout_above="@+id/tabButtomButtons"
            android:padding="5dp"
            >
            <TabWidget android:id="@android:id/tabs"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                ></TabWidget>

            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="fill_parent"
                android:layout_height="match_parent"
                android:padding="5dp" >
            </FrameLayout>
    
        </LinearLayout>
        <RelativeLayout
            android:id="@+id/tabButtomButtons"
            android:layout_width="fill_parent"
            android:layout_height="100dp"
            android:layout_alignParentBottom="true"
            android:background="@color/black_overlay"
            android:padding="5dp"
            >
        </RelativeLayout>
     </RelativeLayout>
</TabHost>
这样就好了:


5 0
原创粉丝点击