【问题标题】:Android edittext view getting trimmed on text inputAndroid edittext 视图在文本输入时被修剪
【发布时间】:2021-04-08 07:46:45
【问题描述】:

我有一个线性布局,在它的底部我有一个 EditText。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:paddingLeft="16dp"
   android:paddingRight="16dp"
   android:orientation="vertical"
   android:gravity="center">

<LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent">
    <TextView
        android:id="@+id/text_view_id"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:text="@string/hello" />
<TextView
        android:id="@+id/title"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:text="@string/hello" />
<TextView
        android:id="@+id/description"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:text="@string/hello" />
 </LinearLayout>

  <EditText
     android:id="@+id/plain_text_input"
     android:layout_height="wrap_content"
     android:layout_width="match_parent"
     android:inputType="text"/>
 </LinearLayout>

问题是,当我运行应用程序并单击编辑文本时,键盘会弹出并修剪我正在输入的任何内容,因此一旦我退出编辑文本,键入的文本在键入过程中不可见,任何人都有关于如何确保在我们输入数据时edittext视图可见并且不会被键盘修剪的建议?

【问题讨论】:

    标签: android android-layout android-fragments textview android-edittext


    【解决方案1】:

    尝试在您的特定活动的清单文件中添加以下行

    android:windowSoftInputMode="adjustPan" 
    

    as explained here

    【讨论】:

      【解决方案2】:

      转到您的 AndroidManifest.xml 文件并在特定活动中使用

      `android:windowSoftInputMode="adjustResize"` 
      

      它应该可以解决您的问题。

      【讨论】:

        猜你喜欢
        • 2018-09-22
        • 2011-05-15
        • 2020-05-24
        • 1970-01-01
        • 1970-01-01
        • 2012-07-17
        • 2017-09-09
        • 2014-10-19
        • 1970-01-01
        相关资源
        最近更新 更多