Как мне поместить полосу поиска в диалоговое окно предупреждения?

Я хочу, чтобы после нажатия кнопки появлялось диалоговое окно с предупреждением, чтобы появилась панель поиска, чтобы пользователь мог изменить значение от 1 до 48. Я создал собственный XML-файл с полосой поиска и двумя текстовыми представлениями, и я хотел бы, чтобы в диалоговом окне было две кнопки, одна просто отменяет диалог, а другая выполняет больше работы. Вот код, который у меня есть на данный момент.

  <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
    <SeekBar android:max="48" android:layout_height="wrap_content" android:id="@+id/seekBar1" android:layout_width="fill_parent" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_marginTop="74dp"></SeekBar>
    <TextView android:text="Change Hour Range" android:layout_height="wrap_content" android:id="@+id/textView1" android:textAppearance="?android:attr/textAppearanceLarge" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true"></TextView>
    <TextView android:text="Only most recent positions" android:layout_height="wrap_content" android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_below="@+id/textView1" android:layout_centerHorizontal="true" android:layout_marginTop="15dp"></TextView>

</RelativeLayout>

Вот диалоговое окно с предупреждениями, которое у меня есть

new AlertDialog.Builder(ImTracking.this)
                    //is there something like setcontentview for alert dialogs?

                    .setPositiveButton("Cancel", null)
                    .setNegativeButton("OK",
                            new DialogInterface.OnClickListener() {
 // does some work here
7
задан Sean 25 August 2011 в 01:17
поделиться