2010-03-12 31 views
12

Tôi có bố cục gần như những gì tôi muốn. Chỉ có một lỗi liên quan đến nút ở dưới cùng. Tôi nên ở dưới cùng mọi lúc. Nhưng bất cứ khi nào tôi đưa lên bàn phím mềm, nút sẽ được hiển thị phía trên bàn phím. Đây không phải là điều tôi muốn nhưng nó sẽ bị bàn phím che phủ.Vui lòng xác minh bố cục của tôi: nút dưới cùng tiếp tục xuất hiện trên bàn phím

Hơn nữa, tôi rất vui nếu bạn có thể nhận xét về cách bố cục được tạo.

Cảm ơn, Steff

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

<LinearLayout android:id="@+id/l_layout_tags" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal"> 
    <TextView 
     android:text="TAGS:" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" /> 
    <AutoCompleteTextView android:id="@+id/actv_tags" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:imeOptions="actionDone" /> 
    <ImageButton android:id="@+id/btn_add_tag" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@android:drawable/ic_input_add" 
     android:onClick="addTag"/> 
</LinearLayout> 

<ScrollView android:id="@+id/sv_scroll_contents" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_below="@id/l_layout_tags" 
    android:scrollbarFadeDuration="2000" > 
    <TableLayout android:id="@+id/t_layout_contents" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:stretchColumns="1" 
     android:paddingRight="5dip"> 
     <TableRow android:id="@+id/tr_template"> 
      <ImageView android:id="@+id/iv_blank" 
       android:src="@android:color/transparent" /> 
      <EditText android:id="@+id/et_content1" 
       android:gravity="top" 
       android:maxWidth="200dp" 
       android:imeOptions="actionDone" /> 
     </TableRow> 
    </TableLayout> 
</ScrollView> 

<LinearLayout android:id="@+id/l_layout_media_btns" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" 
    android:layout_centerHorizontal="true" 
    android:layout_below="@id/sv_scroll_contents" > 
    <ImageButton android:id="@+id/btn_camera" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@android:drawable/ic_menu_camera" 
     android:onClick="takePicture" /> 
    <ImageButton android:id="@+id/btn_video" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@android:drawable/ic_menu_camera" /> 
    <ImageButton android:id="@+id/btn_audio" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@android:drawable/ic_btn_speak_now" /> 
    <ImageButton android:id="@+id/btn_sketch" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@android:drawable/ic_menu_edit" /> 
</LinearLayout> 

<ImageButton android:id="@+id/btn_save_note" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:src="@android:drawable/ic_menu_upload" /> 

</RelativeLayout> 

Trả lời

51

Thêm android:windowSoftInputMode="adjustPan" để thẻ hoạt động của bạn trong AndroidManifest.xml.

Bằng cách này, bàn phím phần mềm sẽ không thay đổi kích thước bố cục của bạn và nút của bạn sẽ vẫn ở dưới nó. Hãy xem here để có ý tưởng tốt hơn về các chế độ bàn phím ảo khác nhau.

+0

Thật tuyệt vời, điều đó đã làm điều đó. Cảm ơn bạn đã giúp đỡ. – stfn

+0

Và bạn có thể tự nhận xét về bố cục không? Nó hoàn toàn dư thừa? Cảm ơn, bạn đời – stfn

+0

Và một điều nữa: khi tôi điền vào EditText thay đổi kích thước tự động (những gì tôi muốn) nó bắt đầu được bao phủ bởi nút được đề cập ở một số điểm. Làm cách nào để tôi có thể sửa đổi Bố cục theo cách sao cho nút ở dưới cùng và không che bất kỳ thứ gì? – stfn

1

Tôi gặp sự cố tương tự. Trong đó tôi luôn phải hiển thị một nút ở cuối màn hình. Tôi đã giải quyết được vấn đề của nút đang đến từ bàn phím theo cách sau:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" 
    android:background="@color/white" 
    android:gravity="center_horizontal" 
    > 
     <ScrollView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:background="@color/white" 
     android:layout_gravity="center" 
     android:id="@+id/ff" 
     > 
       ....... 
     </ScrollView> 

     <LinearLayout android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="1"> 
      <TextView 
      android:id="@+id/txtSigninProblem" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content"   
      android:layout_below="@+id/ff" 
      android:layout_gravity="bottom|center_horizontal"   
      android:text="Problem Signing in?" 
      /> 
     </LinearLayout> 
</LinearLayout> 
Các vấn đề liên quan