gpt4 book ai didi

android - 软键盘打开时不要缩小 ImageView 或背景

转载 作者:行者123 更新时间:2023-11-29 02:25:18 25 4
gpt4 key购买 nike

当键盘打开时,背景会缩小。看看报价:

enter image description here

Activity 有android:windowSoftInputMode="adjustResize"

还有我的布局:

<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/background"
android:scaleType="center"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<FrameLayout
android:id="@+id/container"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />

</android.support.constraint.ConstraintLayout>
</layout>

如何防止这种情况?

最佳答案

试试这个,

在您的 Activity Manifest 中声明 Activity View

android:windowSoftInputMode="adjustResize|stateHidden"

然后按照这段代码:

Bitmap bmImg; // Load a bitmap into bmImg 
BitmapDrawable background = new BitmapDrawable(bmImg);
background.setGravity(Gravity.TOP);
this.setBackgroundDrawable(background);

关于android - 软键盘打开时不要缩小 ImageView 或背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52566875/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com