diff --git a/app/src/main/java/com/example/citrusclient/views/CalendarFragment.java b/app/src/main/java/com/example/citrusclient/views/CalendarFragment.java index e5a7f6d..6229664 100644 --- a/app/src/main/java/com/example/citrusclient/views/CalendarFragment.java +++ b/app/src/main/java/com/example/citrusclient/views/CalendarFragment.java @@ -64,6 +64,8 @@ private TableRow[] tableRows = new TableRow[6]; private TextView curMonth; + private int fixedHeight = 196; + public CalendarFragment() { Calendar calendar = Calendar.getInstance(); year = calendar.get(Calendar.YEAR); //現在の年 @@ -394,15 +396,19 @@ recyclerView.setAdapter(new MyScheduleAdapter(schedules, books)); layout.addView(recyclerView); + layout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { + @Override public void onGlobalLayout() { LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, - layout.getHeight() + fixedHeight ); + System.out.println("Height:" +layout.getHeight()); layout.getChildAt(1).setLayoutParams(layoutParams); - layout.getViewTreeObserver().removeOnGlobalLayoutListener(this); + layout.getViewTreeObserver().removeOnGlobalLayoutListener(this); + } });