I have a LinearLayout and dynamically add three LinearLayouts to it. Each of the LinearLayouts contains a Button. After pressing one of the Buttons I wanted to display a CalendarView in the second-level LinearLayout. The View is displayed, however, it is not shown fully. I have attached a screenshot to visualize the problem: https://i.stack.imgur.com/CE9je.png
Here is the code for adding the layout:
LinearLayout.LayoutParams pLayouts = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT
);
hllCalendar = new LinearLayout(this);
hllCalendar.setLayoutParams(pLayouts);
hllCalendar.setId(hllCalendarID);
hllCalendar.setOrientation(LinearLayout.VERTICAL);
btCalendar = {some other code}
hllCalendar.addView(btCalendar);
hllComponents.addView(hllCalendar);
And here is the code for adding the CalendarView:
LinearLayout.LayoutParams pCalendar = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT
);
CalendarView cal = new CalendarView(this);
cal.setLayoutParams(pCalendar);
cal.setOnDateChangeListener(this);
hllCalendar.addView(cal);
Any suggestions on how I could make the calendar fully visible?
Here is the dynamically created layout for your convenience:
hllComponents pLayouts
-hllCalendar pLayouts
--btCalendar
--CalendarView pCalendar
-hllStartTime pLayouts
--btStartTime
-hllEndTime pLayouts
--btEndTime
The problem is the same as in this post.