繁体   English   中英

出现软键盘时,布局未向上推

[英]Layout not pushed up when Soft keyboard appears

我有一个给定布局层次结构的片段,

在此输入图像描述

在视图寻呼机内我有一个编辑文本。 当键盘出现在EditText的文本中时,整个布局不会被推高。 相反,ViewPager中的内容被推高。 我想要在键盘出现时向上推动外部线性布局中的所有内容。

我怎样才能做到这一点?

谢谢。

将您的Parent LinearLayout放在scrollview中。 这解决了我的问题。

将您的基本布局放在ScrollView中

  <ScrollView
    android:id="@+id/scrollView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <LinearLayout
        android:id="@+id/llPlayersName"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
         >
        // do here the layout work
    </LinearLayout>

</ScrollView>

请记住scrollView cannon可用作基本布局,因此您必须将scrollView放在LinearLayout或RelativeLayout中。

在您的活动的清单条目中,添加

<activity ...
android:windowSoftInputMode="adjustPan">

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM