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

时间:2015-12-22 21:15:19

标签: android android-layout android-viewpager android-softkeyboard

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

enter image description here

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

我怎样才能做到这一点?

感谢。

3 个答案:

答案 0 :(得分:2)

将您的Parent LinearLayout放在滚动视图中。这解决了我的问题。

答案 1 :(得分:1)

将您的基本布局放在 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中。

答案 2 :(得分:0)

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

<activity ...
android:windowSoftInputMode="adjustPan">
相关问题