2017-07-25 3 views
1

Das gesamte Layout wird nach oben gedrückt, wenn die Tastatur aufspringt. Xml-Datei enthält Listenansicht und darunter zwei Tasten, wenn Tastatur Popups sowohl Listenansicht und Schaltflächen nach oben drückt.Layout wird nach oben gedrückt, wenn Tastatur Popups

<?xml version="1.0" encoding="utf-8"?> 
    <LinearLayout 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:orientation="vertical" 
    tools:context="com.example.athis.buy.HomeScreen"> 

    <SearchView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" /> 

    <ListView 
     android:id="@+id/list_item" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_marginTop="10dp" 
     android:layout_weight="8" 
     android:divider="#ffffff" 
     android:dividerHeight="10dp" 
     android:padding="5dp" /> 

    <LinearLayout 
     android:id="@+id/buttons" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" 
     android:background="#a8b3ff" 
     android:gravity="bottom" 
     android:orientation="horizontal" 
     android:weightSum="100"> 

     <Button 
      android:id="@+id/filter" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginEnd="5dp" 
      android:layout_marginLeft="10dp" 
      android:layout_marginRight="5dp" 
      android:layout_marginStart="10dp" 
      android:layout_weight="50" 
      android:text="Filter" 
      android:layout_marginBottom="2dp"/> 

     <Button 
      android:id="@+id/sort" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginEnd="10dp" 
      android:layout_marginLeft="5dp" 
      android:layout_marginRight="10dp" 
      android:layout_marginStart="5dp" 
      android:layout_weight="50" 
      android:text="Sort" 
      android:layout_marginBottom="2dp"/> 
    </LinearLayout> 
</LinearLayout> 

Ich habe android hinzugefügt: windowSoftInputMode = "stateHidden" in manifestieren, so dass, wenn ich EditText berühren nur dann Tastatur

Antwort

1

add windowSoftInputMode="adjustPan" Attribut in Ihrem AndroidManifest.xml für diese bestimmte Activity sollte Pop-up. beziehen Sie sich darauf.

<activity 
     android:name=".activities.YourActivity" 
     android:label="@string/app_name" 
     android:screenOrientation="portrait" 
     android:windowSoftInputMode="adjustPan" /> 

Hoffe, das hilft. GL!

+0

So einfache Lösung, Dank. –

1

Fügen Sie diese auf Ihre Aktivität auf dem Manifest

android: windowSoftInputMode = "adjustPan"

Verwandte Themen