安卓键盘剪切EditText

问题描述 投票:3回答:2

你好,我有一个垂直滚动视图,其中包含多个文本视图。

在底部,我得到了一个EditText,就像一个消息应用程序.我设置在我的清单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

android android-layout
2个回答
2
投票

在AndroidManifest.xml中添加以下选项到你想通过键盘看到 "未剪切 "文本的活动中。android:windowSoftInputMode="adjustPan|stateHidden"

更新可能你需要改变你的edittext样式的padding,因为它似乎是自定义的。


1
投票

在你的manifest的actvity标签中使用android:windowSoftInputMode="adjustResize",它会在软键盘上方显示你的所有视图。

© www.soinside.com 2019 - 2024. All rights reserved.