2012-08-14 85 views
3

你好,我有一个垂直滚动视图,其中包含多个textView。Android键盘剪辑EditText

在底部我有一个EditText,只是lika一个messagin应用程序。 我坐在我的清单android:windowSoftInputMode =“adjustPan”。

问题是,当我点击editText时,我的布局上升,这是很好,但键盘剪切了我的editText一半,就像在图片中。

<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:layout_weight="8" 
    android:background="#CCCCCC" > 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 

     android:orientation="vertical" > 
      //many textView 
      <TextView 
      android:id="@+id/text_area" 
      android:layout_width="fill_parent" 
      android:layout_height="50dp" 
      android:background="#FF0000" 
      android:layout_marginBottom="15dp" 
      android:paddingLeft="10dp" 
      android:textColor="#168191" /> 

      </LinearLayout> 
</ScrollView> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="50dp" 
    android:orientation="horizontal" 
    android:weightSum="10" > 

    <EditText 
     android:id="@+id/send_msg" 
     android:layout_width="0dp" 
     android:layout_height="match_parent" 
     android:layout_weight="8" 
     android:background="#CCDEDC" 
     android:paddingLeft="20dp" 
     android:text="Large Text" 
     android:textColor="#168191" 
     android:textSize="15dp" /> 
     <Button 
     android:id="@+id/send_msg_btn" 
     android:layout_width="0dp" 
     android:layout_height="match_parent" 
     android:layout_weight="2" 
     android:background="#CCCCCC" 
     android:text="Send" 
     android:textColor="#FFFFFF" /> 
</LinearLayout> 

printscreen

+0

我想你必须将带有EditText和Button的LinearLayout放入滚动视图中。他们不在Scrollview标签下,所以“adjustPan”不适合他们。 – 2012-08-14 05:54:16

+1

你需要检查给出[这个问题]的所有答案(http://stackoverflow.com/questions/8000795/android-keyboared-overlaps-with-the-edittext-with-printscreens)。你一定会找到解决问题的办法。 – MKJParekh 2012-08-14 06:07:46

回答

2

添加到AndroidManifest.xml中以下选项你想看到“不拼切”的键盘文本活动。 android:windowSoftInputMode="adjustPan|stateHidden"

UPD 可能是你需要改变你的风格的EditText填充,因为看来,这是自定义的。

+0

感谢您的回复。我添加了“android:windowSoftInputMode =”adjustPan | stateHidden“并删除了左侧填充,但我仍然遇到同样的问题:( – Catalin 2012-08-14 00:36:21

1

使用 android:windowSoftInputMode =“adjustResize” 您的清单的actvity标记。 它会在softKeyboard上方显示所有视图。

+0

如果活动主题已满,则无法使用屏幕 – aProgrammer 2013-03-07 07:25:10