2016-06-28 10 views
0

Das ist einfach mein Layout:Wie EditText und Softkeyboard andere Ansichten angezeigt werden

<?xml version="1.0" encoding="utf-8"?> 
<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:paddingBottom="@dimen/activity_vertical_margin" 
android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 
tools:context="ir11.co.tsco.fll.MainActivity"> 

<ImageView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@drawable/bear" 
    android:text="Hello World!" /> 


<EditText 
    android:layout_alignParentBottom="true" 
    android:layout_width="match_parent" 
    android:layout_height="50dp" 
    android:hint="Comment ..." 
    /> 
</RelativeLayout> 

in manifest ich diese Eigenschaft für ihre Tätigkeit eingestellt haben:

android:windowSoftInputMode="stateHidden|adjustResize" 

aber wenn ich berühren EditText und Softkeyboard erscheint, imageView wird verkleinert !! oder wenn ich die folgende Eigenschaft für ihre Aktivität einstelle:

android:windowSoftInputMode="stateHidden|adjustPan" 

softkeyboard wird push imageView up !.

Das ist nicht was ich will. Ich möchte, dass Edittext + Softkeyboard über ImageView kommt, ohne die Bildansicht zu vergrößern oder zu verkleinern.

was soll ich tun?

+0

Setzen Sie den relativen Eintrag in die Bildlaufansicht – silverFoxA

Antwort

1

Sie so etwas wie dieses

<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" tools:context="com.so3.MainActivity"> <ScrollView android:id="@+id/scroll" android:layout_width="wrap_content" android:layout_height="wrap_content"> <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/bear" android:text="Hello World!" /> </ScrollView> <EditText android:layout_alignParentBottom="true" android:layout_width="match_parent" android:layout_height="50dp" android:hint="Comment ..." /> </RelativeLayout>

und setzen android: windowSoftInputMode = "adjustResize" in Ihrem Manifest

Auch in onCreate() Ihrer Aktivität fügen Sie den folgenden Code ein:

ScrollView sv = (ScrollView)findViewById(R.id.scroll); 
    sv.setEnabled(false); 
0

Schreiben Sie einfach unter Linie in Manifest innerhalb Aktivität Tag:

<activity ........................ 
      android:windowSoftInputMode="stateHidden|adjustNothing"> 
Verwandte Themen