在我的名单上我写了
<activity android:name=".email"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar"
android:windowSoftInputMode="adjustPan">
</activity>在我的版面上我写了
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/white" >
<ImageView
android:id="@+id/bottomImage"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="@drawable/ic_backdrop_wave" />
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:isScrollContainer="false" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<EditText>
</EditText>
<EditText>
</EditText>
<EditText>
</EditText>
</LinearLayout>
</ScrollView>
因此,当我单击任何编辑文本时,它不会重新调整图像视图的大小,但它也将禁用滚动视图。
现在我要做的是,我想要这样的布局,在这种布局中,图像视图的高度不会改变,当任何软键盘打开时,它将坚持对齐父底部,而滚动视图是启用的,而软键盘是打开的。
发布于 2011-07-29 04:31:36
你试过用
android:windowSoftInputMode="adjustResize“
这不会调整图像视图的大小,而是在键盘弹出时自动调整屏幕。
发布于 2020-03-04 14:16:18
这是解决办法。
确保您的图像在ScrollView中的单个子图中,它对齐到底部,如下所示。
<ScrollView
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_width="match_parent"
android:fillViewport="true"
android:isScrollContainer="true"
android:layout_height="0dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
....
....
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/bottom_illustration"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/some_text_view"
app:layout_constraintVertical_bias="1.0"
app:srcCompat="@drawable/login_illustration" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>向ScrollView添加下列属性
android:fillViewport="true"
android:isScrollContainer="true"将此添加到AndroidManifest.xml中的活动标记下
android:windowSoftInputMode="adjustResize"https://stackoverflow.com/questions/6868404
复制相似问题