4

その中にダイアログボックスを作成しますTimePicker。これはポートレート モードでは非常にうまく機能しますが、ランドスケープ モードに変更すると、TimePickerマイナス ボタンが切り取られたように見えます。

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"> 

    <TextView android:id="@+id/text1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Time = " android:textSize="28dp"/>

    <TimePicker android:id="@+id/PickTime" 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/text1" 
        android:layout_alignLeft="@id/text1"/>

    <Button android:id="@+id/StartStop" 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Start"
        android:layout_below="@id/text1" 
        android:layout_toRightOf="@id/PickTime"/>

</RelativeLayout> 

ダイアログボックスを表示するための私のコード:

LayoutInflater factory;
factory = LayoutInflater.from(this);
View textEntryView = factory.inflate(R.layout.test, null);

AlertDialog dialog = new AlertDialog.Builder(this) 
    // .setTitle("Auto-Shutdown Setting")
    .setView(textEntryView)
    .setPositiveButton("Close", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            dialog.cancel();
            /* User clicked OK so do some stuff */
        }
    })
    .create();
dialog.show();

TimePicker timePicker = (TimePicker) dialog.findViewById(R.id.PickTime);
timePicker.setIs24HourView(true);
timePicker.setCurrentHour(12);
timePicker.setCurrentMinute(15);
timePicker.setOnTimeChangedListener(new TimePicker.OnTimeChangedListener() {
    public void onTimeChanged(TimePicker view, int hourOfDay, int minute) {
        // ...
    }        
});

なぜこれが起こっているのか誰にも分かりますか?ダイアログ ボックスのサイズをカスタマイズする (大きくする) ことはできますか? 他の解決策をいただければ幸いです。


JJDによる編集:

ScrollView で日付と時刻のピッカー レイアウトを組み合わせた同様のケースがあるため、ここにスクリーンショットを追加します。@lwijono 最初に説明した内容が表示されない場合は、お気軽に削除してください。または、コメントを残してください。そうします。

縦撮りモードのピッカー

横向きモードのピッカー

4

0 に答える 0