UI问题(底部栏,即主和后按钮隐藏UI组件)



我在UI上放了一个底部按钮,但是背面和主页按钮隐藏了我的布局,所以我无法点击底部按钮,请参阅屏幕1。我已经连接了,,,,[当前视图

它应该看起来像在屏幕截图下,我的底部布局被系统UI组件重叠。http://i63.tinypic.com/kcc5df.jpg

添加布局的XML

<?xml version="1.0" encoding="utf-8"?>
<outworx.in.hangout.Utils.SoftKeyboardLsnedRelativeLayout  xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/myLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="fill_parent"
    android:layout_above="@+id/included_layout">
    <ImageView
        android:id="@+id/user_background"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/bg_cover_new"
        android:scaleType="centerCrop" />
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="fill_parent">

        <include
            android:id="@+id/header_view"
            layout="@layout/top_header"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp" />

        <TextView
            android:id="@+id/welcometxt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/header_view"
            android:layout_marginLeft="20dp"
            android:layout_marginTop="10dp"
            android:text="Welcome "
            android:textColor="@android:color/white"
            android:textSize="@dimen/header_text" />

        <android.support.v4.view.ViewPager
            android:id="@+id/vpPager"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/welcometxt"
            android:layout_marginTop="20dp"
            >
            <android.support.v4.view.PagerTabStrip
                android:id="@+id/pager_header"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="top"
                android:paddingBottom="4dp"
                android:paddingTop="4dp" />
        </android.support.v4.view.ViewPager>

        <android.support.design.widget.FloatingActionButton
            android:id="@+id/floatingButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true"
            android:layout_margin="16dp"
            android:layout_marginBottom="20dp"
            android:layout_marginRight="20dp"
            android:clickable="true"
            android:src="@android:drawable/ic_input_add" />
    </RelativeLayout>
</RelativeLayout>

<include
    android:id="@+id/included_layout"
    layout="@layout/tabview"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true" />
</outworx.in.hangout.Utils.SoftKeyboardLsnedRelativeLayout>

这应该适用于所有设备。将以下代码添加到活动的ongreate():

boolean hasMenuKey = ViewConfiguration.get(context).hasPermanentMenuKey();
boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
if(!hasMenuKey && !hasBackKey) {
    int padding_in_dp = 48;  // 6 dps
    final float scale = getResources().getDisplayMetrics().density;
    int padding_in_px = (int) (padding_in_dp * scale + 0.5f);
    myLayout.setPadding(0,0,0,padding_in_px); //Set Padding bottom to your parent layout
}

希望这会有所帮助。

最新更新