我想创建一个布局,该布局由图像和下一个图像中显示的少量 EditTexts 组成的正常条件
但是当用户开始输入文本时,我需要通过以下方式更改布局:
屏幕底部的软键盘,
EditTexts about it but Image is resized according to the size of soft keyboard as displayed here
我该怎么做?
提前致谢
最佳答案
试试这段代码
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
同时设置
android:windowSoftInputMode="adjustResize"
作为 AndroidManifest.xml
中 Activity 的属性
关于Android在显示软键盘时调整布局的一部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43323091/