ボタンをクリックしてシークバーを表示してから、ユーザーが1-48の値を変更できるようにするために、警告ダイアログボックスを表示します。シークバーと2つのテキストビューを持つカスタムXMLを作成しました。ダイアログボックスには2つのボタンがあり、1つはダイアログをキャンセルし、もう1つはもっと機能します。ここに私がこれまで持っていたコードがあります。アラートダイアログにシークバーを配置するにはどうすればよいですか?
<?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
上で見ることができます。どこにシークバーのメソッドを置くのですか?(変更された進行中の進行中) – Sean
通常どおりにprogressListenerを設定できます。編集を参照してください。 – FoamyGuy
@Tim素晴らしい答え...ありがとう.. – vnshetty