J'essaie d'utiliser le ViewPager2
sur mon application, mais j'ai quelques problèmes pour l'implémenter.
Le problème :
Lorsque je clique sur le
EditText
le clavier apparaît et le boutonViewPager2
redimensionne, en changeant leHeight
Ce que je veux :
Lorsque je clique sur le
EditText
le clavier apparaît et déplacez la touche vue vers le haut et ne pas redimensionner laViewPager2
.
Comment je peux empêcher le ViewPage2
redimensionner et simplement déplacer la vue vers le haut lorsque le clavier apparaît ?
Il y a une propriété à définir ?
Voici mon manifeste
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapplication">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:windowSoftInputMode="stateVisible">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
C'est mon ViewPager2
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.main.BlankFragment">
<TextView
android:id="@+id/textView"
android:layout_width="403dp"
android:layout_height="17dp"
android:text="Something Something Something Something"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!-- <androidx.viewpager.widget.ViewPager-->
<!-- android:id="@+id/view_pager"-->
<!-- android:visibility="gone"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="0dp"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintTop_toBottomOf="@id/textView"-->
<!-- app:layout_behavior="@string/appbar_scrolling_view_behavior" />-->
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/view_pager2"
android:visibility="visible"
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintTop_toBottomOf="@id/textView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
Voici le fragment appelé dans le pager de la vue
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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/constraintLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.main.PlaceholderFragment">
<TextView
android:id="@+id/section_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginBottom="@dimen/activity_vertical_margin"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@+id/constraintLayout"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintTop_creator="1"
tools:text="adasdasdasdasda"/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb asdasdasdasdoahdjasd csdgv dfs bvdf b dsfb dsf bd fb dfb "
app:layout_constraintBottom_toTopOf="@+id/editText"
app:layout_constraintTop_toBottomOf="@+id/section_label" />
<EditText
android:id="@+id/editText"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
Mauvaise présentation / Ce que je veux