本文整理汇总了Java中kankan.wheel.widget.WheelView.getCurrentItem方法的典型用法代码示例。如果您正苦于以下问题:Java WheelView.getCurrentItem方法的具体用法?Java WheelView.getCurrentItem怎么用?Java WheelView.getCurrentItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kankan.wheel.widget.WheelView
的用法示例。
在下文中一共展示了WheelView.getCurrentItem方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateDays
import kankan.wheel.widget.WheelView; //导入方法依赖的package包/类
/**
* Updates day wheel. Sets max days according to selected month and year
*/
private void updateDays(WheelView year, WheelView month, WheelView day) {
Calendar calendar = Calendar.getInstance();
if(year.getCurrentItem() == MaxYearCount &&
month.getCurrentItem() == calendar.get(Calendar.MONTH)) {
int today = calendar.get(Calendar.DAY_OF_MONTH);
day.setViewAdapter(new DateNumericAdapter(mActivity, 1, today, -1));
day.setCurrentItem(today - 1);
} else {
calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) + year.getCurrentItem());
calendar.set(Calendar.MONTH, month.getCurrentItem());
int maxDays = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
day.setViewAdapter(new DateNumericAdapter(mActivity, 1, maxDays, -1));
int curDay = Math.min(maxDays, day.getCurrentItem() + 1);
day.setCurrentItem(curDay - 1);
}
}
示例2: updateDays
import kankan.wheel.widget.WheelView; //导入方法依赖的package包/类
private void updateDays(WheelView year, WheelView month, WheelView day,
WheelView hour, WheelView minute) {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR,calendar.get(Calendar.YEAR) + year.getCurrentItem());// 将给定的日历字段设置为给定值。
calendar.set(Calendar.MONTH, month.getCurrentItem());
int maxDays = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);//给定此 Calendar 的时间值,返回指定日历字段可能拥有的最大值。
dayAdapter = new DateNumericAdapter(this, 1, maxDays,calendar.get(Calendar.DAY_OF_MONTH) - 1);//calendar.get(Calendar.DAY_OF_MONTH)返回给定日历字段的值。
day.setViewAdapter(dayAdapter);
int curDay = Math.min(maxDays, day.getCurrentItem() + 1);// 返回两个
// int值中较大的一个。
day.setCurrentItem(curDay - 1, true);
int years = calendar.get(Calendar.YEAR) - 100;
age = years + "-" + (month.getCurrentItem() + 1) + "-"
+ (day.getCurrentItem() + 1) + "-"
+ (hour.getCurrentItem() + 1) + "-"
+ (minute.getCurrentItem() + 1);
}
示例3: updateMonth
import kankan.wheel.widget.WheelView; //导入方法依赖的package包/类
private void updateMonth(WheelView year, WheelView month) {
int maxMonth = 12;
if(year.getCurrentItem() == MaxYearCount) {
maxMonth = Calendar.getInstance().get(Calendar.MONTH) + 1;
}
month.setViewAdapter(new DateNumericAdapter(mActivity, 1, maxMonth, -1));
int curMonth = Math.min(maxMonth, month.getCurrentItem() + 1);
month.setCurrentItem(curMonth - 1);
}
示例4: onScrollingFinished
import kankan.wheel.widget.WheelView; //导入方法依赖的package包/类
@Override
public void onScrollingFinished(WheelView wheel) {
int currentItem = wheel.getCurrentItem();
String provinceName = provinceArray[currentItem];
int province_id = provinceMap.get(provinceName);
if (provinceName.endsWith("市")) {
initCityMap(province_id, false);
} else {
initCityMap(province_id, true);
}
cityAdapter = new ProviceCityAreaAdapter(DqxxActivity.this,
cityArray, 0);
cityWheelView.setViewAdapter(cityAdapter);
cityWheelView.setCurrentItem(0);
String cityName = cityArray[0];
int city_id = cityMap.get(cityName);
if (provinceName.endsWith("市")) {
city_id = city_id * 100 + 1;
}
initAreaMap(city_id);
areaAdapter = new ProviceCityAreaAdapter(DqxxActivity.this,
areaArray, 0);
areaWheelView.setViewAdapter(areaAdapter);
areaWheelView.setCurrentItem(0);
}