2016-12-26 7 views
1

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

Вот мой макет файл-

<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/scrollView2" 
    android:layout_above="@id/footerView"> 

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

     <TextView 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:text="Name" 
       android:id="@+id/textView40" 
       android:layout_weight="2" 
       android:paddingLeft="30dp" 
       android:textAlignment="gravity" 
       android:layout_gravity="center_vertical" /> 

      <EditText 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:inputType="textPersonName" 
       android:ems="10" 
       android:id="@+id/ETNameSU" 
       android:hint="Daksh Agrawal" 
       android:layout_weight="1" 
       android:layout_marginRight="30dp" /> 

    </LinearLayout> 
</ScrollView> 

<LinearLayout 
    android:id="@+id/footerView" 
    android:layout_width="match_parent" 
    android:layout_height="50dp" 
    android:layout_alignParentBottom="true" 
    android:orientation="horizontal"> 

    <ImageView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/imageView" 
     android:src="@drawable/view_books" 
     android:layout_weight="1" /> 

    <ImageView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/imageView2" 
     android:layout_weight="1" 
     android:src="@drawable/my_profile" /> 

    <ImageView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/imageView3" 
     android:layout_weight="1" 
     android:src="@drawable/post_book" /> 

    <ImageView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/imageView4" 
     android:layout_weight="1" 
     android:src="@drawable/chat" /> 

    <ImageView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/imageView5" 
     android:layout_weight="1" 
     android:src="@drawable/top_donors" /> 
</LinearLayout> 

+0

удалить adjustPan или adjustResize из манифеста. – Noorul

+0

В манифесте нет измененийPan в –

+0

Опубликовать весь xml-макет – Noorul

ответ

1

Добавить это в манифесте деятельности

android:windowSoftInputMode="hidden" 
0

Удалить android:layout_above="@id/footerView"

+0

Они начнут сливаться, когда макет должен прокручиваться ..... мой собственный опыт –

0

скрестите пальцы позволяет настроить (Испытано это- и работает для меня очень хорошо!)

В ваш OnCreate инициализируйте свой rootView (родительский вид в XML) и ваш footerView

называют этот метод из вашего OnCreate - когда клавиатура вверх footerView видимость изменения

public void testKeyBoardUp(){ 
     rootView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { 
      @Override 
      public void onGlobalLayout() { 
       Rect r = new Rect(); 
       rootView.getWindowVisibleDisplayFrame(r); 
       int heightDiff = rel.getRootView().getHeight() - (r.bottom - r.top); 

       if (heightDiff > 100) { // if more than 100 pixels, its probably a keyboard... 
        //ok now we know the keyboard is up... 
        footer.setVisibility(View.INVISIBLE); 


       }else{ 
        //ok now we know the keyboard is down... 
        footer.setVisibility(View.VISIBLE); 


       } 
      } 
     }); 
    } 

Надеюсь, вам понравится