簡體   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