2014-10-20 4 views
0

Макет не отображается полностью, когда клавиатура всплывает. Я пробовал много примеров. Но это не работает. Любая помощь будет оценена. Спасибо заранее. Мой манифест. XML-файлКак изменить размер макета при отображении клавиатуры

 <activity 
     android:name=".activity.SignUp" 
     android:windowSoftInputMode="stateVisible|adjustResize" 
     android:configChanges="keyboardHidden|orientation|screenSize" 
     android:screenOrientation="portrait" 
     /> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 

Мой файл макета

<?xml version="1.0" encoding="utf-8"?> 
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fitsSystemWindows="true" 
android:focusableInTouchMode="false" 
android:orientation="vertical"> 


<ImageView 
    android:id="@+id/imageView" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentTop="true" 
    android:layout_centerHorizontal="true" 
    android:layout_marginTop="40dp" 
    android:src="@drawable/userprofile" /> 

<EditText 
    android:id="@+id/editText" 
    android:layout_width="200dp" 
    android:layout_height="wrap_content" 
    android:layout_centerVertical="true" 
    android:layout_marginBottom="-10dp" 
    android:layout_marginLeft="80dp" 
    android:hint="USERNAME" 
    android:inputType="textPersonName" 
    /> 

<ImageView 
    android:id="@+id/imageView3" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/editText" 
    android:layout_marginLeft="39dp" 
    android:layout_marginTop="30dp" 
    android:src="@drawable/email" /> 

<EditText 
    android:id="@+id/editText2" 
    android:layout_width="200dp" 
    android:layout_height="wrap_content" 
    android:layout_alignBottom="@+id/imageView3" 
    android:layout_alignLeft="@+id/editText" 
    android:layout_alignStart="@+id/editText" 
    android:hint="ENTER EMAIL" 
    android:inputType="textEmailAddress" 
    /> 

<ImageView 
    android:id="@+id/imageView4" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/imageView3" 
    android:layout_marginLeft="39dp" 
    android:layout_marginTop="20dp" 
    android:src="@drawable/passunlock" /> 

<EditText 
    android:id="@+id/editText3" 
    android:layout_width="200dp" 
    android:layout_height="wrap_content" 
    android:layout_alignTop="@+id/imageView4" 
    android:layout_marginLeft="80dp" 
    android:layout_marginTop="-15dp" 
    android:hint="ENTER PASSWORD" 
    android:inputType="textPassword" 
    android:text="password" /> 

<ImageView 
    android:id="@+id/imageView5" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_above="@+id/imageView6" 
    android:layout_alignLeft="@+id/imageView4" 
    android:layout_alignStart="@+id/imageView4" 
    android:src="@drawable/password" /> 

<EditText 
    android:id="@+id/editText4" 
    android:layout_width="200dp" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/editText3" 
    android:layout_marginLeft="80dp" 
    android:layout_marginTop="10dp" 
    android:hint="RETYPE PASSWORD" 
    android:inputType="textPassword" 
    android:text="password" /> 

<ImageView 
    android:id="@+id/imageView6" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/editText4" 
    android:layout_centerHorizontal="true" 
    android:layout_marginTop="39dp" 
    android:src="@drawable/signup" /> 

<TextView 
    android:id="@+id/textView" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignBottom="@+id/imageView6" 
    android:layout_centerHorizontal="true" 
    android:layout_marginBottom="10dp" 
    android:text="SIGN UP" 
    android:textAppearance="?android:attr/textAppearanceLarge" 
    android:textColor="@android:color/white" /> 

<ImageView 
    android:id="@+id/imageView2" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerVertical="true" 
    android:layout_marginRight="-14dp" 
    android:layout_toLeftOf="@+id/imageView6" 
    android:layout_toStartOf="@+id/imageView6" 
    android:src="@drawable/username" /> 

+0

вы можете добавить scrollview в качестве контейнера в xml с андроидом: fillViewport = "true", а в манифесте достаточно только параметра adjustresize. – MOSO

ответ

1

Set Mode Window SoftInput свойство adjustPan и adjustResize

<activity android:windowSoftInputMode="adjustPan|adjustResize"> </activity> OR 
<activity android:windowSoftInputMode="adjustResize"> </activity> OR 
<activity android:windowSoftInputMode="adjustPan"> </activity> 

Если какой-либо из выше не работает, то используйте этот код ниже в onCreate() метода:

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); 
Смежные вопросы