本文整理汇总了Java中android.widget.ViewAnimator.findViewById方法的典型用法代码示例。如果您正苦于以下问题:Java ViewAnimator.findViewById方法的具体用法?Java ViewAnimator.findViewById怎么用?Java ViewAnimator.findViewById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ViewAnimator
的用法示例。
在下文中一共展示了ViewAnimator.findViewById方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AppCompatDatePickerDelegate
import android.widget.ViewAnimator; //导入方法依赖的package包/类
public AppCompatDatePickerDelegate(AppCompatDatePicker delegator, Context context, AttributeSet attrs,
int defStyleAttr, int defStyleRes) {
super(delegator, context);
final Locale locale = mCurrentLocale;
mCurrentDate = Calendar.getInstance(locale);
mTempDate = Calendar.getInstance(locale);
mMinDate = Calendar.getInstance(locale);
mMaxDate = Calendar.getInstance(locale);
mMinDate.set(DEFAULT_START_YEAR, Calendar.JANUARY, 1);
mMaxDate.set(DEFAULT_END_YEAR, Calendar.DECEMBER, 31);
final Resources res = mDelegator.getResources();
final TypedArray a = mContext.obtainStyledAttributes(attrs,
R.styleable.DatePickerDialog, defStyleAttr, defStyleRes);
final LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
// Set up and attach container.
mContainer = (ViewGroup) inflater.inflate(R.layout.date_picker_material, mDelegator, false);
mDelegator.addView(mContainer);
// Set up header views.
final ViewGroup header = (ViewGroup) mContainer.findViewById(R.id.date_picker_header);
mHeaderYear = (TextView) header.findViewById(R.id.date_picker_header_year);
mHeaderYear.setOnClickListener(mOnHeaderClickListener);
mHeaderMonthDay = (TextView) header.findViewById(R.id.date_picker_header_date);
mHeaderMonthDay.setOnClickListener(mOnHeaderClickListener);
// Set up header text color, if available.
ColorStateList headerTextColor;
if (a.hasValue(R.styleable.DatePickerDialog_headerTextColor)) {
headerTextColor = a.getColorStateList(R.styleable.DatePickerDialog_headerTextColor);
} else {
headerTextColor = PickerThemeUtils.getHeaderTextColorStateList(mContext);
}
mHeaderYear.setTextColor(headerTextColor);
mHeaderMonthDay.setTextColor(headerTextColor);
// Set up header background, if available.
ViewCompatUtils.setBackground(header, PickerThemeUtils.getHeaderBackground(mContext,
a.getColor(R.styleable.DatePickerDialog_headerBackground,
ThemeUtils.getThemeAttrColor(mContext, R.attr.colorAccent))));
a.recycle();
// Set up picker container.
mAnimator = (ViewAnimator) mContainer.findViewById(R.id.animator);
// Set up day picker view.
mDayPickerView = (DayPickerView) mAnimator.findViewById(R.id.date_picker_day_picker);
mDayPickerView.setFirstDayOfWeek(mFirstDayOfWeek);
mDayPickerView.setMinDate(mMinDate.getTimeInMillis());
mDayPickerView.setMaxDate(mMaxDate.getTimeInMillis());
mDayPickerView.setDate(mCurrentDate.getTimeInMillis());
mDayPickerView.setOnDaySelectedListener(mOnDaySelectedListener);
// Set up year picker view.
mYearPickerView = (YearPickerView) mAnimator.findViewById(R.id.date_picker_year_picker);
mYearPickerView.setRange(mMinDate, mMaxDate);
mYearPickerView.setDate(mCurrentDate.getTimeInMillis());
mYearPickerView.setOnYearSelectedListener(mOnYearSelectedListener);
// Set up content descriptions.
mSelectDay = res.getString(R.string.select_day);
mSelectYear = res.getString(R.string.select_year);
// Initialize for current locale. This also initializes the date, so no
// need to call onDateChanged.
onLocaleChanged(mCurrentLocale);
setCurrentView(VIEW_MONTH_DAY);
}