微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

焦点键盘在特定行后与textview重叠

如何解决焦点键盘在特定行后与textview重叠

我的观点有问题。我有一个文本视图和一个带有图像视图的线性布局。线性布局具有一个称为

属性
android:fitsSystemWindows="true"

我的活动已启用

android:windowSoftInputMode="adjustResize"

,以便当焦点键盘处于打开状态时,具有该图像视图的线性布局将停留在焦点键盘上方,否则它将停留在底部。 问题是每当我键入4或5行时,编辑文本的光标就会被线性布局所阻塞。尽管我可以键入它,但是我需要向下滚动才能看到我的文本和光标。

我的xml代码如下:

 <androidx.appcompat.widget.AppCompatEditText
            android:id="@+id/edtAnswer"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/fifteen_margin"
            android:layout_marginTop="@dimen/ten_margin"
            android:background="@android:color/transparent"
            android:hint="@string/add_answer"
            android:inputType="textCapSentences|textMultiLine|text"
            android:textColor="@color/text_hint"
            app:backgroundTint="@color/edit_text_color" />



<LinearLayout
    android:id="@+id/llChooser"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/white"
    android:fitsSystemWindows="true"
    android:orientation="vertical"
    android:padding="10dp"
    android:windowSoftInputMode="adjustResize"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintStart_toStartOf="parent">

    <ImageView
        android:id="@+id/ivAnswerImage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:contentDescription="@string/content_desc_image"
        android:src="@drawable/ic_choose_photo" />
</LinearLayout>

有人可以帮助我吗?每当更改线条时,我都需要使光标和文本可见。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。