Как сохранить положительные/отрицательные кнопки DialogFragment над программной клавиатурой

Я использую DialogFragment. Я хочу, чтобы положительные и отрицательные кнопки оставались над клавиатурой, когда пользователь взаимодействует с текстом редактирования, как на приведенных ниже примерах изображений с экрана в приложении для планшетов Gmail.

without soft keyboard

With soft keyboard - buttons remain above keyboard as dialog resizes and content scrolls

В моей попытке, которая не работает, вот мой метод Dialog Fragments onCreateDialog

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {   

    LayoutInflater factory = LayoutInflater.from(getActivity());
    final View textEntryView = factory.inflate(R.layout.my_layout, null);

    return new AlertDialog.Builder(getActivity())                
            .setTitle(getString(R.string.paypal))
            .setView(textEntryView)
            .setPositiveButton(R.string.dialog_ok,
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {                          

                    }
                }
            )
            .setNegativeButton(R.string.dialog_cancel,
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {

                    }
                }
            )
            .create();
}

и вот R.layout.my_layout

<?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" 
        android:fillViewport="true">


    <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical">
        <ImageView android:id="@+id/paypal_button"
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:layout_marginTop="15dip"
               android:layout_marginBottom="15dip"

             />
        <EditText
            android:id="@+id/edit_paypal_email"
                style="@style/GeneralEditText"
                android:hint="@string/contact_info_text_email"
                android:inputType="textEmailAddress"
                />

           <View 
            android:id="@id/horizontal_line"
            style="@style/HorizontalLine"
            android:layout_marginTop="@dimen/contact_info_line_margin_top" />

        <!-- Notes -->
        <TextView
            android:text="@string/paypal_info1"
            style="@style/ContactInfoNotes"
            android:paddingBottom="5dip"
            />  

        <TextView
            android:text="@string/paypal_info2"
            style="@style/ContactInfoNotes"
            android:paddingBottom="5dip"
            />

        <TextView
            android:text="@string/paypal_info3"
            style="@style/ContactInfoNotes"
            android:paddingBottom="5dip"
            />
        <TextView
            android:text="@string/paypal_info4"
            style="@style/ContactInfoNotes"
            android:paddingBottom="5dip"
            />

    </LinearLayout> 
</ScrollView>

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

Заранее спасибо.

15
задан Dittimon 20 June 2012 в 00:07
поделиться