Android键盘剪切EditText

时间:2012-08-14 00:23:53

标签: android android-layout

您好我有一个包含多个textView的垂直scrollview。

在底部我有一个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

2 个答案:

答案 0 :(得分:2)

将以下选项添加到AndroidManifest.xml,以便通过键盘查看“未切割”文本的活动。 android:windowSoftInputMode="adjustPan|stateHidden"

<强> UPD 可能是您需要更改您的edittext样式的填充,因为它似乎是自定义的。

答案 1 :(得分:1)

使用 机器人:windowSoftInputMode = “adjustResize” 在清单的actvity标签中。 它将在softKeyboard上方显示您的所有视图。