Программная клавиатура покрывает EditText в PopupWindow

Я собрал простой тестовый проект, который отображает всплывающее окно, содержащее EditText (в Android 2.2). Когда я нажимаю EditText, отображается программная клавиатура, как я и ожидал. Однако программная клавиатура закрывает EditText, и я не могу заставить экран панорамировать, чтобы держать EditText в поле зрения так, как я бы думал. Мой код:

TestAdjustPanActivity.java:

package com.example;

import android.app.Activity;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.Gravity;
import android.widget.PopupWindow;

public class TestAdjustPanActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        final PopupWindow pw = new PopupWindow(this);
        pw.setContentView(getLayoutInflater().inflate(R.layout.popup, null, false));
        pw.setWidth(400);
        pw.setHeight(600);
        pw.setFocusable(true);

        pw.setOutsideTouchable(true);
        pw.setTouchable(true);
        pw.setBackgroundDrawable(new BitmapDrawable());

        // This is the line referred to in the edit:
        pw.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);

        findViewById(R.id.main).post(new Runnable() {
            public void run() {
            pw.showAtLocation(findViewById(R.id.main), Gravity.NO_GRAVITY, 0, 0);
            }
        });
    }
}

main.xml:

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

    <TextView
        android:id="@+id/text"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />

</LinearLayout>

popup.xml:

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

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="#666666"
        android:orientation="vertical" >

        <EditText
            android:id="@+id/current_password"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="40dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:layout_marginTop="300dp" />
    </LinearLayout>

</ScrollView>

... и мой AndroidManifest.xml содержит строкуandroid:windowSoftInputMode="stateUnspecified|adjustPan" в теге для одного и того же действия в приложении.

Есть идеи? Ни один из других постов на SO, связанных с этой проблемой, не сделал это для меня. Чего мне не хватает, что не дает панорамированию так, как я ожидал?

РЕДАКТИРОВАТЬ: я попытался добавить строку в TestAdjustPanActivity, как указано, что заставило экран отлично панорамировать на устройстве Android 3.2, которое у меня есть. Тем не менее, он все еще не работает на моем устройстве Android 2.2, что делает это еще более запутанным.

Ответы на вопрос(5)

Ваш ответ на вопрос