コード例 #1
0
 private void scrollToSelectedMonth(final int selectedIndex) {
   post(
       new Runnable() {
         @Override
         public void run() {
           Logr.d("Scrolling to position %d", selectedIndex);
           setSelection(selectedIndex);
         }
       });
 }
コード例 #2
0
 /**
  * This method should only be called if the calendar is contained in a dialog, and it should only
  * be called once, right after the dialog is shown (using {@link
  * android.content.DialogInterface.OnShowListener} or {@link
  * android.app.DialogFragment#onStart()}).
  */
 public void fixDialogDimens() {
   Logr.d("Fixing dimensions to h = %d / w = %d", getMeasuredHeight(), getMeasuredWidth());
   // Fix the layout height/width after the dialog has been shown.
   getLayoutParams().height = getMeasuredHeight();
   getLayoutParams().width = getMeasuredWidth();
   // Post this runnable so it runs _after_ the dimen changes have been
   // applied/re-measured.
   post(
       new Runnable() {
         @Override
         public void run() {
           Logr.d("Dimens are fixed: now scroll to the selected date");
           scrollToSelectedDates();
         }
       });
 }