2017-02-20 41 views
0

我已經在我的用戶界面上放置了一個底部按鈕,但隱藏了我的佈局,因此我無法點擊底部按鈕。屏幕1.我已附加, [Current View用戶界面問題(底部欄,即家庭和後退按鈕,隱藏用戶界面組件)

它應該看起來像下面的屏幕截圖,我的底部佈局被系統UI組件重疊。 http://i63.tinypic.com/kcc5df.jpg

添加布局

<?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> 
+0

添加布局文件.. –

+0

@Dhruv Tyagi我已附加鏈接到屏幕 – outW

+0

在您的xml佈局中肯定存在問題。無法檢測到只是看你的截圖。請提供您的xml代碼。 – tahsinRupam

回答

0

的XML這應該適用於所有設備。將以下代碼添加到activity的onCreate()中:

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 
} 

希望這有助於。