本文整理汇总了Java中com.playuav.android.widgets.spinnerWheel.adapters.NumericWheelAdapter.setItemResource方法的典型用法代码示例。如果您正苦于以下问题:Java NumericWheelAdapter.setItemResource方法的具体用法?Java NumericWheelAdapter.setItemResource怎么用?Java NumericWheelAdapter.setItemResource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.playuav.android.widgets.spinnerWheel.adapters.NumericWheelAdapter
的用法示例。
在下文中一共展示了NumericWheelAdapter.setItemResource方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onApiConnected
import com.playuav.android.widgets.spinnerWheel.adapters.NumericWheelAdapter; //导入方法依赖的package包/类
@Override
public void onApiConnected() {
super.onApiConnected();
final View view = getView();
final Context context = getActivity().getApplicationContext();
typeSpinner.setSelection(commandAdapter.getPosition(MissionItemType.CIRCLE));
final NumericWheelAdapter altitudeAdapter = new NumericWheelAdapter(context, MIN_ALTITUDE,
MAX_ALTITUDE, "%d m");
altitudeAdapter.setItemResource(R.layout.wheel_text_centered);
CardWheelHorizontalView altitudePicker = (CardWheelHorizontalView) view
.findViewById(R.id.altitudePicker);
altitudePicker.setViewAdapter(altitudeAdapter);
altitudePicker.addChangingListener(this);
final NumericWheelAdapter loiterTurnAdapter = new NumericWheelAdapter(context,
R.layout.wheel_text_centered, 0, 10, "%d");
CardWheelHorizontalView loiterTurnPicker = (CardWheelHorizontalView) view
.findViewById(R.id.loiterTurnPicker);
loiterTurnPicker.setViewAdapter(loiterTurnAdapter);
loiterTurnPicker.addChangingListener(this);
final NumericWheelAdapter loiterRadiusAdapter = new NumericWheelAdapter(context, 0, 50,
"%d m");
loiterRadiusAdapter.setItemResource(R.layout.wheel_text_centered);
CardWheelHorizontalView loiterRadiusPicker = (CardWheelHorizontalView) view
.findViewById(R.id.loiterRadiusPicker);
loiterRadiusPicker.setViewAdapter(loiterRadiusAdapter);
loiterRadiusPicker.addChangingListener(this);
// Use the first one as reference.
final Circle firstItem = getMissionItems().get(0);
altitudePicker.setCurrentValue((int) firstItem.getCoordinate().getAltitude());
loiterTurnPicker.setCurrentValue(firstItem.getTurns());
loiterRadiusPicker.setCurrentValue((int) firstItem.getRadius());
}
示例2: WheelHorizontalView
import com.playuav.android.widgets.spinnerWheel.adapters.NumericWheelAdapter; //导入方法依赖的package包/类
/**
* Create a new wheel horizontal view.
*
* @param context
* the application environment.
* @param attrs
* a collection of attributes.
* @param defStyle
* The default style to apply to this view.
*/
public WheelHorizontalView(final Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// Create a dummy view adapter if we're in edit mode.
if (isInEditMode()) {
final NumericWheelAdapter adapter = new NumericWheelAdapter(context, 0, 100);
adapter.setItemResource(R.layout.wheel_text_centered);
setViewAdapter(adapter);
setCurrentItem(50);
}
}