2014-01-10 135 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> 

一个在过去总是被写在其他布局,所以如果您希望按钮位于图像布局上方,例如将其写入图像下方的布局中