2011-05-24 59 views
12

活動強制adjustPan我的佈局是這樣的:含滾動型

<RelativeLayout> 
    <RelativeLayout> 
    </RelativeLayout> 
    <ViewFlipper> 
     <ScrollView> 
      <LinearLayout> 
       <EditText /> 
      </LinearLayout> 
     </ScrollView> 
    </ViewFlipper> 
    <RelativeLayout> 
    </RelativeLayout> 
</RelativeLayout> 

當在中間集中在EditText上,軟鍵盤彈出如預期,但是它總是重新調整佈局,即使我有android:windowSoftInputMode="adjustPan"在清單中。

調整大小的問題是隻有ScrollView縮小,使RelativeLayouts保持完好無損,這幾乎可以完全遮掩EditText。

我試圖隱藏RelativeLayouts當鍵盤顯示(這是另一個悲傷的故事),但adjustPan聽起來更合適。但它對此活動沒有影響。

即使存在ScrollView,我如何強制adjustPan工作?

更新:

SO不會讓我回答我的問題,但解決的辦法是上了滾動設置android:isScrollContainer="false"

+0

這節省了我大量的時間。非常感謝! – 2011-06-25 18:45:18

回答

-1

在您的清單試試這個的活動標籤:

android:windowSoftInputMode="stateVisible|adjustPan" 
+5

根據android文檔,您不應該使用adjustResize&adjustPan標籤。它應該是一個或另一個。 – Rise 2012-11-30 11:50:12

0

好問題大多是開發商做同樣的事情,但是這是不是你需要做的正確道路。這會幫助你。

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical"> 


<ViewFlipper> 
    <ScrollView 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     > 
     <LinearLayout 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical" 
     > 
      <EditText /> 
     </LinearLayout> 
    </ScrollView> 
</ViewFlipper> 
<LinearLayout> 

你應該採取的LinearLayout與定向垂直或水平視圖,你從來沒有調整問題created.this是非常簡單的。