2012-10-04 205 views
1

我有一個佈局,我有頭和列表的某些部分:部分佈局disapear時鍵盤顯示

<?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:background="@color/bisque"> 
    <LinearLayout 
     xmlns:treeView="http://schemas.android.com/apk/res/com.spot.p2a" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_toLeftOf="@+id/backArrow" 
     android:orientation="vertical" 
     android:weightSum="100" 
     android:background="@color/antiquewhite"> 

     <LinearLayout 
      android:id="@+id/email_listview_top" 
      android:layout_width="match_parent" 
      android:layout_height="0dp" 
      android:layout_weight="20" 
      android:orientation="vertical" 
      android:background="@color/bisque" > 

      <TextView 
       android:id="@+id/email_listview_header" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/pdf_mail_versand_text" 
       android:textColor="@color/black" 
       android:layout_marginTop="30dp" 
       android:layout_marginLeft="20dp" 
       android:textStyle="bold" 
       android:textSize="24dp" /> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:layout_marginTop="20dp" 
       android:orientation="vertical" 
       android:background="@color/antiquewhiter"> 
      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="5dp" 
       android:orientation="vertical" 
       android:background="@color/antiquewhite"> 
      </LinearLayout> 
       <TextView 
        android:id="@+id/headList" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="@string/datenblätter_text" 
        android:textColor="@color/black" 
        android:layout_marginLeft="20dp" 
        android:layout_marginTop="20dp" 
        android:textStyle="bold" 
        android:textSize="14dp" /> 

      </LinearLayout> 

     </LinearLayout> 

     <pl.polidea.treeview.TreeViewList 
      android:id="@+id/tree" 
      android:layout_width="match_parent" 
      android:layout_height="0dp" 
      android:layout_weight="80" 
      android:background="@color/antiquewhiter" 
      treeView:indicator_gravity="right|center_vertical" 
      android:scrollbars="vertical" 
      android:smoothScrollbar="true"/> 


    <!--  <ListView --> 
    <!--   android:id="@android:id/list" --> 
    <!--   android:layout_width="match_parent" --> 
    <!--   android:layout_height="0dp" --> 
    <!--   android:layout_weight="80" --> 
    <!--   android:fadingEdge="none" --> 
    <!--   android:background="@color/antiquewhiter" --> 
    <!--   android:divider="@color/bisque" --> 
    <!--   android:dividerHeight="2dp" --> 
    <!--   android:visibility="gone" --> 
    <!--   > --> 
    <!--  </ListView> --> 

    </LinearLayout> 
    <ImageView 
     android:id="@+id/backArrow" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:visibility="gone" 
     android:layout_alignParentRight="true" 
     android:layout_centerVertical="true" 
     android:src="@drawable/back_android" /> 
</RelativeLayout> 

當我告訴鍵盤上的電話這個部分:

<LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_marginTop="20dp" 
        android:orientation="vertical" 
        android:background="@color/antiquewhiter"> 
       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="5dp" 
        android:orientation="vertical" 
        android:background="@color/antiquewhite"> 
       </LinearLayout> 
        <TextView 
         android:id="@+id/headList" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:text="@string/datenblätter_text" 
         android:textColor="@color/black" 
         android:layout_marginLeft="20dp" 
         android:layout_marginTop="20dp" 
         android:textStyle="bold" 
         android:textSize="14dp" /> 

       </LinearLayout> 

      </LinearLayout> 

disapear。我不知道爲什麼。當我隱藏鍵盤時,這部分再次顯示。如果有人有這個問題,請解釋爲什麼有些部件在鍵盤顯示在屏幕上時隱藏起來?

回答

1

閱讀Android windowSoftInputMode

所以,你可以改變模式,在下面的語句中的「AndroidManifest」,「調整」到你的活動。

<activity android:name=".YourActivity" 
      android:windowSoftInputMode="adjustResize">