2017-03-02 26 views
-1

我想在鍵盤像下面打開時向上滾動entair屏幕。怎麼做?如何在啓用鍵盤時將內容屏幕向上移動?

https://www.screencast.com/t/34JwVngLdYbU

+1

在你的activity標籤中使用'android:windowSoftInputMode =「adjustResize」'參見 –

+0

請參考[link1](http://stackoverflow.com/questions/1964789/move-layouts-up-when-soft-keyboard-是顯示)和[link2]爲您的參考(http://stackoverflow.com/questions/9111813/how-to-move-the-layout-up-when-the-soft-keyboard-is-shown-android) –

+0

android:windowSoftInputMode =「adjustResize這一個工作正常 –

回答

0

應用android:windowSoftInputMode="adjustPan|adjustResize"與清單文件活動代碼。

+0

android:windowSoftInputMode =」adjustPan | adjustResize「不適合我 –

+0

使用android:windowSoftInputMode =」adjustResize「並將您的佈局放在滾動視圖中。 – Vaibhavi

0
android:windowSoftInputMode="adjustPan|adjustResize" 

,並把完整的佈局LinearLayoutScrollView &定義

layout_height="0dp" 
layout_weight="1" 

注:沒有查看有沒有參數layout_height="match_parent"

0

我也同樣的問題,只是增加一行到我AndroidManifest文件的活動。

<activity 
     android:name=".activities.YOURACTIVITY" 
     android:screenOrientation="portrait" 
     android:theme="@style/AppTheme.NoActionBar" 
     android:windowSoftInputMode="adjustResize|stateVisible"/> 

如果你想鍵盤應該開始活動似乎再使用stateVisible以其它方式使用stateHidden

這裏最重要的值是adjustResize。這將改變整個用戶界面,爲軟鍵盤留出空間。

相關問題