У меня есть кнопка внутри диалогового окна выбора времени. При нажатии на него никаких действий не происходит.
Dialog time_schedule = new Dialog(this);
time_schedule.setContentView(R.layout.alarm_timer); // alarm_timer XML layout
View v2 = View.inflate(this, R.layout.alarm_timer, null);
time_schedule.getWindow().setBackgroundDrawable(new ColorDrawable(0));
final TimePicker time = v2.findViewById(R.id.timePicker1);
Button alarm = v2.findViewById(R.id.buttonAlarm);
time_schedule.show();
alarm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
time_schedule.dismiss();
}
});
Xml file ..................................... ..........................................
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#00555555"
android:padding="10dp">
<TimePicker
android:id="@+id/timePicker1"
android:background="#00555555"
android:headerBackground="#30555555"
android:layout_width="wrap_content"
android:numbersSelectorColor="#30555555"
android:layout_height="420dp" />
<Button
android:id="@+id/buttonAlarm"
android:background="#30555555"
android:layout_marginBottom="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/timePicker1"
android:text="ON Time" />
</RelativeLayout>