2017-05-15 5 views
0

Je suis confronté au problème, lorsque le clavier logiciel est apparu, la disposition du cadre en haut de l'activité est poussée vers le haut. La disposition du cadre est placée dans la disposition linéaire et en dessous la scrollview est placée à l'intérieur. J'ai essayé les réponses affichées dans le débordement de la pile mais mon problème n'est toujours pas résolu. Je suis buliding l'application dans la version sdk cible 25 et la version 16 minimale.Comment éviter que la disposition de l'image ne soit poussée vers le haut lorsque le clavier logiciel apparaît?

J'ai appliqué la méthode ci-dessous à l'activité dans AndroidManifestFile.

<activity android:name=".Activities.ScamLookUpActivity" 
      android:configChanges="keyboard|keyboardHidden|screenSize|screenLayout|" 
      android:screenOrientation="portrait" 
      android:windowSoftInputMode="adjustResize"/>` 

Je ne sais pas comment résoudre cette erreur et dire la raison pour laquelle la raison pour laquelle la méthode donnée n'appllied à mon activité.

Ceci est mon fichier de mise en page xml ...

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:id="@+id/activity_scam_look_up" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" 
android:background="#eee" 
tools:context="com.zcodia.scamlookup.Activities.ScamLookUpActivity"> 

<FrameLayout 
    android:id="@+id/frameLayout" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    > 

    <View 
     android:layout_width="match_parent" 
     android:layout_marginTop="20dp" 
     android:layout_height="?android:attr/actionBarSize" 
     android:background="@mipmap/bg_splash_cut"> 


    </View> 
    <View 
     android:layout_width="match_parent" 
     android:layout_height="25dp" 
     android:alpha="1" 
     android:background="#A82A37" /> 
    <TextView 
     android:id="@+id/left_buton" 
     android:layout_width="30dp" 
     android:layout_height="30dp" 
     android:layout_marginLeft="12dp" 
     android:layout_marginTop="30dp" 
     android:text="@string/menu" 
     android:textSize="30dp" 
     android:gravity="center" 
     android:textColor="#FFF"/> 

    <com.zcodia.scamlookup.Utils.CustomTextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Scam lookup" 
     android:layout_marginTop="29dp" 
     android:layout_marginLeft="60dp" 
     android:textSize="20dp" 
     android:textColor="#FFF" 
     android:gravity="center"/> 

</FrameLayout> 

<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    android:background="#f9f9f9" 
    android:focusableInTouchMode="true" 
    android:paddingBottom="20dp"> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" 
    android:paddingBottom="10dp" 
    android:background="@drawable/text_input2" 
    > 

    <com.zcodia.scamlookup.Utils.CustomTextView 
     android:text="Search Scam Database" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="10dp" 
     android:layout_marginLeft="10dp" 
     android:id="@+id/textView4" 
     android:textSize="20dp" 
     android:textColor="#000" 
     android:layout_below="@+id/linearLayout" 
     android:typeface="sans" 
     /> 

    <com.zcodia.scamlookup.Utils.CustomTextView 
     android:text="Contact Medium" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/textView4" 
     android:layout_marginLeft="10dp" 
     android:id="@+id/details_id" 
     android:textColor="#D32F2F" 
     android:typeface="sans" 
     android:textSize="15dp" 
     android:layout_marginTop="10dp"/> 


    <android.support.v7.widget.RecyclerView 
     android:layout_width="wrap_content" 
     android:layout_height="60dp" 
     android:id="@+id/recyclerView" 
     ></android.support.v7.widget.RecyclerView> 


</LinearLayout> 

<com.zcodia.scamlookup.Utils.CustomTextView 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:text="Category" 
    android:id="@+id/textView5" 
    android:layout_below="@+id/linearLayout2" 
    android:layout_marginTop="10dp" 
    android:layout_marginLeft="15dp" 
    android:textColor="#D32F2F" 
    android:textSize="15dp" 
    /> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginLeft="10dp" 
    android:orientation="vertical" 
    android:paddingBottom="20dp" 
    android:id="@+id/relative_spinner" 
    android:focusableInTouchMode="true"> 


    <RelativeLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="15dp" 
     android:background="@drawable/textinput" 
     android:layout_marginRight="10dp"> 

    <Spinner 

     android:layout_width="match_parent" 
     android:layout_height="50dp" 
     android:layout_alignParentTop="true" 
     android:id="@+id/categorySpinner" 
     android:text="@string/inheritance" 
     android:prompt="@string/inheritance" 
     android:paddingLeft="0dp" 
     /> 

    </RelativeLayout> 

    <RelativeLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="15dp" 
     android:background="@drawable/textinput" 
     android:layout_marginRight="10dp"> 

     <Spinner 

      android:layout_width="match_parent" 
      android:layout_height="50dp" 
      android:layout_marginTop="1dp" 
      android:id="@+id/categorySpinner2" 
      android:text="@string/inheritance" 
      android:prompt="@string/inheritance" 
      android:paddingLeft="0dp" 
      /> 

    </RelativeLayout> 

    <com.zcodia.scamlookup.Utils.CustomEditText 
     android:inputType="phone" 
     android:id="@+id/phoneNumber_editText" 
     android:hint="@string/phonenumber" 
     android:typeface="sans" 
     style="@style/CustomFontStyle" 
     android:layout_marginTop="20dp" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true" /> 


    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="20dp"> 

     <AutoCompleteTextView 
      android:layout_width="match_parent" 
      android:layout_height="50dp" 
      android:layout_marginLeft="0dp" 
      android:layout_marginRight="10dp" 
      android:layout_marginTop="0dp" 
      android:id="@+id/yourLocation" 
      android:hint="Location" 
      android:textColorHint="#757575" 
      style="@style/CustomFontStyle"/> 

     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="330dp" 
      android:text="&#xf041;" 
      android:id="@+id/scammer_location_font" 
      android:textColor="#3eb3a0" 
      android:textSize="25dp" 
      android:layout_marginTop="10dp"/> 

    </RelativeLayout> 

    <com.zcodia.scamlookup.Utils.CustomEditText 
     android:inputType="textPersonName" 
     android:hint="@string/scammer_location" 
     android:id="@+id/scammerLocation_editText" 
     android:typeface="sans" 
     style="@style/CustomFontStyle" 
     android:layout_marginTop="20dp" 
    /> 

    <com.zcodia.scamlookup.Utils.CustomEditText 

     android:inputType="textPersonName" 
     android:hint="@string/keyWord" 
     android:id="@+id/keyword_edittext" 
     android:background="@drawable/textinput" 
     android:typeface="sans" 
     style="@style/CustomFontStyle" 
     android:layout_marginTop="20dp" 
     /> 

</LinearLayout> 

    <com.wefika.flowlayout.FlowLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/clip_flow_layout" 
     android:layout_marginLeft="10dp" 
     android:layout_marginRight="10dp"> 

    </com.wefika.flowlayout.FlowLayout> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="10dp" 
     > 

     <com.zcodia.scamlookup.Utils.CustomButton 
      android:text="Search" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/search_id" 
      android:background="@mipmap/bg_splash_cut" 
      android:textColor="#FFFFFF" 
      android:layout_marginLeft="10dp" 
      android:layout_marginRight="10dp"/> 


    </LinearLayout> 

</ScrollView> 

L'image ci-dessous est mon activité.

enter image description here

lorsque l'on appuie sur edittext la mise en page de cadre supérieur est poussé vers le haut.

enter image description here

Répondre

0

appliquer cet attribut à la vue de défilement: android:fitsSystemWindows="true" et Suivre ce

link

+0

toujours pas résolu le problème –

+0

u peut utiliser linéaire mise en page au lieu de la mise en page du cadre. –

+0

Je l'ai essayé mais ne fonctionne pas –

1

Essayez cette réponse,

<activity android:windowSoftInputMode="adjustPan"> </activity>