2011-05-23 103 views
2

我試圖做一個應用程序,其中佈局內的內容是密集的。不過,我想功能,這將讓我展示重點的EditText在屏幕的上半部分,而軟鍵盤彈出...如何在彈出軟鍵盤時使聚焦的EditText可見?

到目前爲止,我的研究說我必須使用...

<activity android:windowSoftInputMode="adjustUnspecified" android:name=".main"> 
     <intent-filter> 
      <action android:name="com.last.project.main" /> 
      <category android:name="android.intent.category.DEFAULT" /> 
     </intent-filter> 
    </activity> 

我有被告知(這)android:windowSoftInputMode =「adjustUnspecified」Manifest.xml行將解決我的問題,但它似乎並沒有工作。 (我被告知意味着....從這個鏈接我看http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft

只需要知道爲什麼它不工作......是否有任何其他原因可能會影響我的清單XML只是忽略了我寫過嗎?

不要讓我知道如果任何其他代碼需要

感謝堆,

克里奧

我的佈局XML是...

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" android:layout_width="match_parent" 
android:layout_height="match_parent"> 
<LinearLayout android:layout_height="wrap_content" 
    android:id="@+id/linearLayout1" 
    android:layout_width="match_parent"> 
    <ImageView android:src="@drawable/header" 
     android:layout_height="wrap_content" 
     android:id="@+id/imageView1" 
     android:layout_width="match_parent" > 
    </ImageView> 
</LinearLayout> 
<LinearLayout android:layout_height="wrap_content" 
    android:id="@+id/linearLayout2" 
    android:layout_width="match_parent" 
    android:baselineAligned="false" 
    android:layout_gravity="fill"> 
     <Button android:layout_height="wrap_content" 
      android:text="English" android:id="@+id/button1" 
      android:onClick="languageSelectionButtonFrom" 
      android:layout_width="wrap_content" 
      android:layout_weight="2"> 
     </Button> 
     <ImageButton android:layout_height="wrap_content" 
      android:src="@drawable/arrow" 
      android:id="@+id/imageButton1" 
      android:layout_width="wrap_content"> 
     </ImageButton> 
     <Button android:text="English" 
      android:onClick="languageSelectionButtonTo" 
      android:id="@+id/button3" 
      android:layout_gravity="right" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="2"> 
     </Button> 
</LinearLayout> 
<TableLayout android:id="@+id/tableLayout1" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
     <EditText android:hint="Text to translate..." 
      android:layout_width="wrap_content" 
      android:id="@+id/editText1" 
      android:layout_height="wrap_content"> 
     </EditText> 
     <Button android:text="Translate" 
      android:id="@+id/button4" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:onClick="translationButtonClickHandler" > 
     </Button> 
     <TextView android:text="Translation :" 
      android:textSize="15sp" 
      android:id="@+id/textView1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content"> 
     </TextView> 
     <EditText android:text="" 
      android:layout_width="wrap_content" 
      android:id="@+id/editText2" 
      android:scrollbars="vertical" 
      android:layout_weight="4" 
      android:gravity="top" 
      android:layout_height="match_parent"> 
     </EditText> 
    </TableLayout> 
</LinearLayout> 

回答

2

問題已經解決謝謝大家誰試圖腦strom ...

答案是...我們mu st將所有佈局內容放在滾動視圖中以獲得此功能!

所以,在我的情況

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fillViewport="true"> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" android:layout_width="match_parent" 
android:layout_height="match_parent"> 
....(All other content omitted for whole file reference same xml text inside question) 
</LinearLayout> 
</ScrollView> 
相關問題