Этот вопрос задан раньше, но я не могу найти хороший ответ, который работает на меня.Как переместить кнопку над клавиатурой?
Вот мой XML-код (обновлено):
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Account Name"
android:textSize="32dp"
android:layout_marginTop="15dp"
android:layout_marginLeft="15dp"
android:id="@+id/textView" />
<EditText
android:layout_width="match_parent"
android:layout_height="40dp"
android:id="@+id/accountName"
android:background="@drawable/edit_text_background"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:padding="10dp"
android:backgroundTint="@color/abc_secondary_text_material_light" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Account Balance"
android:textSize="32dp"
android:layout_marginTop="15dp"
android:layout_marginLeft="15dp"/>
<EditText
android:layout_width="match_parent"
android:layout_height="40dp"
android:inputType="numberDecimal"
android:id="@+id/accountBalance"
android:background="@drawable/edit_text_background"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:padding="10dp"
android:backgroundTint="@color/abc_secondary_text_material_light"
android:text="£"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:text="New Button"
android:id="@+id/button"
android:layout_gravity="center_horizontal"
android:layout_alignParentBottom="true"
/>
</RelativeLayout>
Я попытался с помощью android:windowSoftInputMode="adjustPan|adjustResize"
однако он не работал.
Я чувствую, что я делаю что-то неправильно с расположением кода XML ... Похоже, что это, и я хочу кнопку, чтобы двигаться вверх, когда появится клавиатура:
Возьмите Xml-код в Scrollview –
Попробуйте RelativeLayout как родительский. – Ajit
Просто добавьте 'android: windowSoftInputMode =" adjustPan "' в ваш тэг активности в вашем файле манифеста. – Apurva