I'm new to Android, and really Java also. In my app, I've got an alert dialog I'm throwing up that displays a date and time picker for the user to select a datetime they would like to send a message. That part is going fine.
In my xml, when I set a background attribute, which is currently blue and has a corner radius, there is seemingly an additional white background without a corner radius peeking out behind it. I'm a little miffed. Any help is appreciated.
xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="@drawable/corners_qk"
android:layout_width="match_parent"
android:padding="8dp"
android:layout_height="match_parent">
<DatePicker
android:id="@+id/date_picker"
android:layout_width="match_parent"
android:calendarViewShown="true"
android:spinnersShown="false"
android:layout_weight="4"
android:layout_height="0dp" />
<TimePicker
android:id="@+id/time_picker"
android:layout_weight="4"
android:layout_width="match_parent"
android:layout_height="0dp" />
<Button
android:id="@+id/date_time_set"
android:layout_weight="1"
android:layout_width="match_parent"
android:background="@drawable/corners"
android:text="@string/picker_button"
android:layout_height="0dp" />
</LinearLayout>
corners_qk.xml:
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<corners
android:radius="5dp" />
<solid
android:color="@color/qkblue"/>
</shape>
colors.xml:
<resources>
<color name="red">#FF0000</color>
<color name="qkblue">#2483d0</color>
</resources>
java:
final View dialogView = View.inflate(this, R.layout.date_time_picker, null);
final AlertDialog alertDialog = new AlertDialog.Builder(this).create();
dialogView.findViewById(R.id.date_time_set).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
DatePicker datePicker = (DatePicker) dialogView.findViewById(R.id.date_picker);
TimePicker timePicker = (TimePicker) dialogView.findViewById(R.id.time_picker);
Calendar calendar = new GregorianCalendar(datePicker.getYear(),
datePicker.getMonth(),
datePicker.getDayOfMonth(),
timePicker.getCurrentHour(),
timePicker.getCurrentMinute());
long time = calendar.getTimeInMillis();
try {
messageSend();
} catch (JSONException | IOException e) {
e.printStackTrace();
}
}});
alertDialog.setView(dialogView);
alertDialog.show();