2012-01-09 12 views
5

Tôi gặp sự cố khi tôi nhấp vào Chỉnh sửa văn bản Bàn phím SoftInput ghi đè hai tiện ích Một là TextView và một là nút Đăng nhập có trong Relative Layout, nhưng tôi muốn khi chúng ta chọn bất kỳ Edit Text, toàn bộ bố cục Relative sẽ đi lên và tất cả các widget được hiển thị trên bàn phím softinput của Android mặc định. Xin vui lòng đề nghị tôi cho các giải pháp đúng.Bố cục sẽ xuất hiện khi bàn phím mềm đứng trước màn hình trong Android

Xin cảm ơn trước.

Layout của tôi:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" android:layout_width="fill_parent" 
    android:layout_height="fill_parent" android:background="#ffffff"> 
    <FrameLayout android:id="@+id/frame" 
     android:layout_gravity="top|bottom|center_horizontal" 
     android:layout_width="wrap_content" android:layout_marginTop="10dip" android:layout_height="wrap_content"> 

     <ImageView 
      android:id="@+id/imageView1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_horizontal" 
      android:background="@drawable/logo" > 
</ImageView> 
    </FrameLayout> 
    <RelativeLayout android:id="@+id/frameLayout1" 
     android:layout_width="wrap_content" android:background="@drawable/login_box_bg" 
     android:layout_gravity="center_horizontal" android:layout_height="220dip" android:layout_marginTop="20dip"> 
     <EditText android:id="@+id/ed_Login_Email" 
      android:background="@drawable/login_input_bg" android:layout_gravity="center_horizontal" android:layout_marginTop="10dip" android:hint="Email:" android:paddingLeft="10dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:inputType="text" android:layout_centerHorizontal="true"> 
     </EditText> 
     <EditText android:background="@drawable/login_input_bg" android:layout_gravity="center_horizontal" android:id="@+id/ed_Login_Pwd" 
      android:inputType="textPassword" android:hint="Password:" android:paddingLeft="10dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="50dip" android:layout_centerHorizontal="true"> 
     </EditText> 

     <ImageView 
      android:id="@+id/img_Login_RememberUnchecked" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" android:background="@drawable/checkbox_unchkd_large" android:layout_gravity="top|left" android:layout_marginLeft="15dip" android:layout_marginTop="100dip" android:clickable="true"/> 

     <TextView 
      android:id="@+id/tv_Login_RememberMeUnchecked" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Remember Me" android:textColor="#000000" android:layout_gravity="top|left" android:layout_marginLeft="35dip" android:layout_marginTop="102dip" android:clickable="true"/> 

     <Button 
      android:id="@+id/btn_Login_Login" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/tv_Login_RememberMeUnchecked" 
      android:layout_centerHorizontal="true" 
      android:layout_marginTop="14dp" 
      android:background="@drawable/login_btn_bg" 
      android:text="LOG IN" 
      android:textColor="#ffffff" /> 

     <TextView 
      android:id="@+id/tv_Login_ForgotPwd" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="true" 
      android:layout_centerHorizontal="true" 
      android:layout_marginBottom="15dp" 
      android:clickable="true" 
      android:text="Forgot your password?" 
      android:textColor="#000000" /> 

    </RelativeLayout> 


</LinearLayout> 

Vui lòng tham khảo bên dưới hình ảnh cho sự hiểu biết hơn:

enter image description here

enter image description here

Tôi đã thử với android: windowSoftInputMode = "stateVisible | adjustResize "nhưng không có gì xảy ra, vấn đề vẫn giữ nguyên.

+0

bạn có thể dùng thuốc này không? http://stackoverflow.com/questions/8000795/android-keyboared-overlaps-with-the-edittext-with-printscreens – MKJParekh

+0

kiểm tra các softinputmodes khác nhau cho edittext – Nitin

+0

Cách chúng tôi kiểm tra các chế độ softinput khác nhau? –

Trả lời

10

Vui lòng thay đổi chế độ nhập mềm của cửa sổ để Đổi kích thước, Để thay đổi chế độ thành "đổi kích thước", hãy thêm tuyên bố sau vào hoạt động của bạn trong tệp AndroidManifest.

<activity android:name="YourActivityName" android:windowSoftInputMode="adjustResize"> 
+0

Người dùng cho biết anh ta đã thử 'adjustResize'. Tại sao bạn lại nói với anh ta? –