2014-01-10 95 views
2

我的應用程序有layuot活動這樣Android的 - 滾動型不推升時,鍵盤會出現

<RelativeLayout 
    android:id="@+id/layoutMain" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@drawable/backgroundchatfixed"> 

    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_above="@+id/layoutKhungChat" 
     android:id="@+id/svChat"> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical" 
      android:id="@+id/layoutChat"> 

     </LinearLayout> 

    </ScrollView> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="@drawable/background_khungchat" 
     android:layout_alignParentBottom="true" 
     android:id="@+id/layoutKhungChat"> 

     <EditText 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:background="@drawable/khungchat_chat" 
      android:layout_centerVertical="true" 
      android:id="@+id/etChatbox"/> 

    </RelativeLayout> 

</RelativeLayout> 

當我撫摸我的EDITTEXT,只有佈局「layoutKungChat」推高。 任何解決方案也推動上滾動視圖? 謝謝。

+0

sho有些發生了什麼事情。 – keshav

回答

1

嘗試在清單中添加該到活動標籤:

android:windowSoftInputMode="adjustPan" 
+0

我試過了,但不起作用 –

0

使用此代碼

<RelativeLayout 
android:id="@+id/layoutMain" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="@drawable/backgroundchatfixed"> 
<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="@drawable/background_khungchat" 
    android:layout_alignParentBottom="true" 
    android:id="@+id/layoutKhungChat"> 

    <EditText 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:background="@drawable/khungchat_chat" 
     android:layout_centerVertical="true" 
     android:id="@+id/etChatbox"/> 

</RelativeLayout> 
<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_above="@+id/layoutKhungChat" 
    android:id="@+id/svChat"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" 
     android:id="@+id/layoutChat"> 

    </LinearLayout> 

</ScrollView> 

一個在過去總是被寫在其他佈局,所以如果您希望按鈕位於圖像佈局上方,例如將其寫入圖像下方的佈局中