Gui*_*lhE 5 android view android-softkeyboard android-constraintlayout
我有ConstraintLayout以下层次结构:
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="parent"/>
<RecyclerView
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="Button"
app:layout_constraintTop_toBottomOf="EditText"/>
<Button
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
</ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)
当EditText获得焦点时,键盘会弹出,将Button(因此RecyclerView)向上推。我不希望这种情况发生,让键盘自由,而不推动任何视图。
我尝试了很多android:windowSoftInputMode组合(下面的例子)但没有运气。也是ScrollView“黑客”,但也没有运气。
<activity
android:name=".Activity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan"/>
Run Code Online (Sandbox Code Playgroud)
我怎样才能实现这个目标?
ButtonPS:我能想到的唯一解决方案是在键盘出现时隐藏。
小智 2
做这个
<activity
...
android:windowSoftInputMode="adjustPan">
</activity>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2825 次 |
| 最近记录: |