I'm making a date picker with a title but the view its ugly because there is no margin bottom, how can i make a margin to make it little pretty?
As you can see it's very ugly.
My code:
if(endTime.isEmpty() || startTime.isEmpty()){
int CustomHour = 12;
int CustomMinute = 00;
int hour = CustomHour;
int minute = CustomMinute;
TimePickerDialog tpd = new TimePickerDialog(ActivityAlarm.this, new TimePickerDialog.OnTimeSetListener()
{
int callCount = 0; //To track number of calls to onTimeSet()
@Override
public void onTimeSet(TimePicker timePicker, int selectedHour, int selectedMinute)
{
...
}, hour, minute, DateFormat.is24HourFormat(ActivityAlarm.this));
tpd.setTitle("Set Time");
// Create a new instance of TimePickerDialog and return it
return tpd;
}
try this:
In code do this:
LayoutInflater inflater = this.getLayoutInflater();
View dialogView = inflater.inflate(R.layout.text_layout, null);
TextView texts=(TextView) dialogView.findViewById(R.id.textss);
texts.setText("Start Time");
tpd.setCustomTitle(dialogView);
In xml make a file named:
text_layout.xml
<?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="match_parent"
android:padding="10dp">
<TextView
android:id="@+id/textss"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>