Ich habe einen EditText auf der Unterseite meines Layouts und ein paar TextViews auf der Oberseite. Wenn ich auf EditText klicke, bewegt es sich von unten über die Tastatur, was gut ist. Aber die TextViews bewegen sich auch nach oben und außerhalb des Bildschirms, sodass Sie sie erst sehen können, wenn Sie die Tastatur wieder schließen. Wie kann ich das vermeiden und habe trotzdem meinen EditText über der Tastatur? Ich verwende ein RelativeLayout. Danke!EditText verschiebt TextView beim Öffnen der Tastatur aus dem Bildschirm
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.ncss.tyfby.Feeling"
android:background="#1baa84">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<TextView
android:text="I am"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/IamTV"
android:layout_weight="0.10"
android:textSize="40sp"
android:textStyle="normal|bold"
android:gravity="bottom" />
<EditText
android:layout_width="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/iamAdjective"
android:background="@android:drawable/editbox_background_normal"
android:hint="powerful"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginLeft="10dp" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/send"
android:layout_weight="0.10"
android:src="@android:drawable/ic_menu_send"
android:background="@drawable/transparent"
android:onClick="send"
android:layout_marginLeft="5dp" />
</LinearLayout>
<TextView
android:text="I am"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/iam1"
android:textSize="18sp" />
<TextView
android:text="I am"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/iam2"
android:textSize="18sp"
android:layout_below="@+id/iam1"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="10dp" />
<TextView
android:text="I am"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/iam4"
android:textSize="18sp"
android:layout_below="@+id/iam3"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="10dp" />
<TextView
android:text="I am"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/iam5"
android:textSize="18sp"
android:layout_below="@+id/iam4"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="10dp" />
<TextView
android:text="I am"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/iam3"
android:textSize="18sp"
android:layout_below="@+id/iam2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="10dp" />
Teilen Sie Ihr Layout xml bitte – Kushan
@Yannik Pieper- Legen Sie Ihre gesamte Ansicht in Scroll, so dass Sie nach oben und sehen, Dein Inhalt. Das ist es ...... – Bhavnik
Gibt es keine Option, wo ich TextView oben bleiben kann, während der editText nach oben geht? Scrollen ist in diesem Fall eine sehr schlechte Lösung ... –