调整调整大小的活动查看传呼机不工作以上21

问题描述:

我有查看寻呼机里面的活动与四个片段,每个片段的中心编辑文本和底部的按钮。但是当软键盘弹出时,按钮不作相应的调整,按钮不可见(位于键盘后面)。调整调整大小的活动查看传呼机不工作以上21

我的代码:

main_activity.xml //activity layout 


<android.support.v4.widget.DrawerLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/drawer_layout" 
    android:fitsSystemWindows="true" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/white" 
    tools:openDrawer="start"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"> 

     <include 
      layout="@layout/toolbar_main_screen" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" /> 

     <android.support.design.widget.TabLayout 
      android:id="@+id/tab_layout" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      app:tabMode="scrollable" 
      android:visibility="gone" 
      /> 

     <android.support.v4.view.ViewPager 
      android:id="@+id/viewPager" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      /> 

    </LinearLayout> 


    <android.support.design.widget.NavigationView 
     android:id="@+id/nav_view" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:layout_gravity="start" 
     android:background="@color/white" 
     android:fitsSystemWindows="true" 
     app:itemBackground="@drawable/nav_item_background" 
     app:itemTextAppearance="@style/NavDrawerTextStyle" 
     app:headerLayout="@layout/drawer_header" 
     app:menu="@menu/drawer_menu" /> 


</android.support.v4.widget.DrawerLayout> 


first_fragment.xml //fragment_layout 

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="#000000" 
    android:fitsSystemWindows="true" 
    android:padding="40dp"> 

    <LinearLayout 
     android:layout_alignParentBottom="true" 
     android:id="@+id/buttons" 
     android:background="#000000" 
     android:orientation="horizontal" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     > 

     <Button 
      android:layout_width="0dp" 
      android:layout_weight="1" 
      android:layout_height="wrap_content" 
      android:background="#000000" 
      android:text="BACK" 
      android:visibility="invisible" 
      android:textColor="#ffffff" /> 

     <Button 
      android:id="@+id/next_degree" 
      android:layout_width="0dp" 
      android:layout_weight="1" 
      android:layout_height="wrap_content" 
      android:background="@drawable/button_next" 
      android:text="Next" 
      android:layout_marginLeft="@dimen/size40dp" 
      android:textSize="@dimen/fontSize16sp" 
      android:textColor="@color/black" /> 

    </LinearLayout> 


    <AutoCompleteTextView 
     android:layout_centerInParent="true" 
     android:imeOptions="actionDone" 
     android:maxLines="1" 
     android:layout_marginTop="@dimen/size8dp" 
     android:layout_width="match_parent" 
     android:id="@+id/degree" 
     android:backgroundTint="@color/black" 
     android:layout_height="wrap_content" 
     android:text="B.Tech" 
     android:textSize="@dimen/fontSize20sp" 
     android:textColor="@color/white" 
     android:textCursorDrawable="@drawable/color_cursor" 
     /> 

    <TextView 
     android:layout_above="@id/degree" 
     android:paddingLeft="4dp" 
     android:textColor="#999999" 
     android:text="Degree *" 
     android:textSize="@dimen/fontSize16sp" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" /> 

</RelativeLayout> 
+0

在manifiest.xml加入这一行的活动'里面的android:windowSoftInputMode =“stateHidden | adjustResize”' –

+0

编辑和发布您的XML – jagapathi

+0

安置自己的XML和Java代码 – EKN

按我的理解上面的棒棒糖,我们必须添加以下属性调整大小调整功能。

android:fitsSystemWindows="true" 

请试试这个。

+0

这应该在活动布局或片段布局添加? –

+0

在你的清单中 – EKN