[英]ScrollView is not Working in ConstraintLayout and viewPage
I am working with constraint layout I am trying to use scrollview within it, Especially when keypad occurs on screen.我正在使用约束布局我试图在其中使用滚动视图,尤其是当键盘出现在屏幕上时。 When keypad appears alignment completely changes and scrollview doesn't appear当键盘出现时 alignment 完全改变并且没有出现滚动视图
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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_height="match_parent"
android:layout_width="match_parent"
android:fillViewport="true"
tools:context=".Activity.HomeActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/Constrain_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg"
android:orientation="vertical"
>
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/toolbar_gradient"
android:minHeight="?attr/actionBarSize"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Button"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<androidx.viewpager.widget.ViewPager
android:id="@+id/pager"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/button3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tabLayout"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</androidx.constraintlayout.widget.ConstraintLayout>
Use this android:windowSoftInputMode="adjustPan"
in activity tag in manifest在清单的活动标记中使用此android:windowSoftInputMode="adjustPan"
Example:例子:
<activity
android:name=".activities.MainActivity"
android:windowSoftInputMode="adjustPan" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.