我知道有關於此的一千個問題,但我已經爬過他們,他們的解決方案都沒有爲我工作。Android軟鍵盤沒有調整我的視圖
我的活動有這種佈局的一個標籤式界面:
<RelativeLayout>
<LinearLayout tabBar>
<Button tab1 />
<Button tab2 />
<Button tab3 />
<Button tab4 />
</LinearLayout>
<ViewFlipper>
<fragment Tab1 />
<fragment Tab2 />
<fragment Tab3 />
<fragment Tab4 />
</ViewFlipper>
</RelativeLayout>
當TAB2按鈕在LinearLayout中抽頭然後我改變ViewFlipper顯示孩子2是由Tab2Fragment控制。
Tab2Fragment的佈局是這樣的:
<FrameLayout>
<ListView/>
</FrameLayout>
當選擇在ListView中的項目,我創建了一個新的片段,讓我們稱之爲Sub2Fragment,我將其添加爲孩子的FrameLayout裏。
Sub2Fragment有這樣的佈局:當顯示軟鍵盤
<LinearLayout android:layout_height="fill_parent" android:layout_width="fill_parent">
<LinearLayout> <TextView /> <EditText /> </LinearLayout>
<LinearLayout> <TextView /> <EditText /> </LinearLayout>
<LinearLayout> <TextView /> <EditText /> </LinearLayout>
<LinearLayout> <TextView /> <EditText /> </LinearLayout>
<Button />
</LinearLayout>
它涵蓋了一些我的EditTexts和我的按鈕的。我已經試過包裝即用的LinearLayout滾動型,以及:
<ScrollView android:layout_height="fill_parent" android:layout_width="fill_parent">
<LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent">
<LinearLayout> <TextView /> <EditText /> </LinearLayout>
<LinearLayout> <TextView /> <EditText /> </LinearLayout>
<LinearLayout> <TextView /> <EditText /> </LinearLayout>
<LinearLayout> <TextView /> <EditText /> </LinearLayout>
<Button />
</LinearLayout>
</ScrollView>
我也試過我的表現有和沒有android:windowSoftInputMode="adjustResize"
我的活動,但沒有我嘗試獲取視圖自動調整,這樣的滾動型會讓我滾動瀏覽整個內容,當軟鍵盤可見時。
我也嘗試將整個活動包裝在一個ScrollView中,但是這樣搞砸了我的整個佈局,因爲它是基於填充整個屏幕大小和ScrollView從屏幕的實際大小斷開子佈局...
任何幫助?
我剛剛在我的代碼中發現了同樣的問題。經過3個小時的調試,我已將其縮小到同樣的準確度!有誰知道任何解決方案,以獲得全屏和調整大小的工作? – Leo 2012-04-06 18:32:31
這是一個錯誤。供參考:http://stackoverflow.com/questions/6395328/adjustresize-android – nagoya0 2012-08-24 01:29:06