2016-09-02 3 views
1

У меня есть нижний колонтитул в моем приложении, но у меня проблема, когда нижний колонтитул поднимается каждый раз, когда выходит клавиатура. Я добавил код "android:windowSoftInputMode="adjustPan" в файл манифеста, но он не исправил его. Ниже приведен обычный вид с скрытой клавиатурой.клавиатура подталкивает нижний колонтитул

This is the normal view with keyboard hidden

Это то, что мой взгляд выглядит как с клавиатуры видимой. Я бы хотел, чтобы клавиатура закрывала нижний колонтитул, а не подталкивала его.

second

Ниже мой код для макета

<android.support.design.widget.CoordinatorLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/myCoordinatorLayout" 
    xmlns:android="http://schemas.android.com/apk/res/android"> 

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:tools="http://schemas.android.com/tools" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/icons_container" 
     tools:context=".app.LoginActivity"> 

     <android.support.v7.widget.Toolbar 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:background="@color/colorPrimary" 
      android:id="@+id/toolBar"> 

      <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:src="@drawable/loginbannerimage" 
       android:contentDescription="banner" 
       android:layout_gravity="center_horizontal"/> 

     </android.support.v7.widget.Toolbar> 


     <ScrollView 
      android:id="@+id/login_form" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_below="@+id/toolBar"> 

      <LinearLayout 

       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:orientation="vertical"> 

       <!-- Login progress --> 
       <include layout="@layout/custom_progress_bar"/> 

       <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        app:cardUseCompatPadding="true" 
        app:cardElevation="3dp" 
        xmlns:app="http://schemas.android.com/apk/res-auto" 
        app:cardBackgroundColor="@android:color/black" 
        android:layout_marginBottom="0dp"> 

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

          <android.support.v7.widget.CardView 
           android:layout_width="match_parent" 
           android:layout_height="match_parent" 
           app:cardBackgroundColor="@color/toolBar" 
           app:cardCornerRadius="0dp"> 

           <TextView 
            android:layout_width="match_parent" 
            android:layout_height="wrap_content" 
            android:text="Welcome To MAP" 
            android:textColor="@android:color/white" 
            android:textSize="20sp" 
            android:layout_gravity="center_horizontal" 
            android:padding="5dp" 
            android:gravity="center_horizontal" /> 
          </android.support.v7.widget.CardView> 


         </LinearLayout> 

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

          <android.support.v7.widget.CardView 
           android:layout_width="match_parent" 
           android:layout_height="match_parent" 
           app:cardBackgroundColor="@color/cardBg" 
           app:cardCornerRadius="0dp" 
           android:padding="0dp"> 

           <LinearLayout 
            android:layout_width="match_parent" 
            android:layout_height="match_parent" 
            android:orientation="vertical" 
            android:padding="15dp"> 
            <EditText 
             android:id="@+id/email" 
             android:layout_width="match_parent" 
             android:layout_height="wrap_content" 
             android:hint="Email here" 
             android:maxLines="1" 
             android:singleLine="true" /> 

            <EditText 
             android:id="@+id/password" 
             android:layout_width="match_parent" 
             android:layout_height="wrap_content" 
             android:hint="Password" 
             android:imeActionLabel="Password here" 
             android:imeOptions="actionUnspecified" 
             android:inputType="textPassword" 
             android:maxLines="1" 
             android:singleLine="true" /> 

            <Button 
             android:id="@+id/email_sign_in_button" 
             style="?android:textAppearanceSmall" 
             android:layout_width="wrap_content" 
             android:layout_height="wrap_content" 
             android:layout_marginTop="16dp" 
             android:text="Sign-in" 
             android:textStyle="bold" 
             android:elevation="5dp" 
             android:textColor="@color/colorPrimaryDark" 
             android:background="@android:color/white" 
             android:layout_gravity="center_horizontal" /> 
           </LinearLayout> 

          </android.support.v7.widget.CardView> 
         </LinearLayout> 
        </LinearLayout> 


       </android.support.v7.widget.CardView> 

      </LinearLayout> 

     </ScrollView> 

      <include layout="@layout/footer" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_alignParentBottom="true"> 
      </include> 

    </RelativeLayout> 

</android.support.design.widget.CoordinatorLayout> 

ответ

0

Это потому, что ваш колонтитул имеет значение высоты

wrap_content 

, а другая часть/с (те, сжимаются) имеют значение

match_parent 

и если он не имеет определенное значение или wrap_content, он будет сжат для размещения клавиатуры!

0

Или вы можете использовать это в своем scrollView. Это решило мою проблему.

android:windowSoftInputMode="stateVisible|adjustPan" 
Смежные вопросы