2014-10-20 52 views
0

佈局是不可見的完全的鍵盤時,popup.I已經嘗試了很多example.But的它不是working.Any幫助將是advance.My清單appreciated.Thanks。 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

您可以在XML中添加滾動視圖作爲容器與Android:fillViewport =「true」,並在清單只是adjustresize就夠了。 – MOSO 2014-10-20 06:53:50

回答

1

設置窗口SoftInput Mode屬性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);