本文整理汇总了Java中android.support.test.espresso.matcher.ViewMatchers.isAssignableFrom方法的典型用法代码示例。如果您正苦于以下问题:Java ViewMatchers.isAssignableFrom方法的具体用法?Java ViewMatchers.isAssignableFrom怎么用?Java ViewMatchers.isAssignableFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.test.espresso.matcher.ViewMatchers
的用法示例。
在下文中一共展示了ViewMatchers.isAssignableFrom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setNumber
import android.support.test.espresso.matcher.ViewMatchers; //导入方法依赖的package包/类
/**
* Set value for {@link NumberPicker}
*/
public static ViewAction setNumber(final int n) {
return new ViewAction() {
@Override
public void perform(UiController uiController, View view) {
((NumberPicker) view).setValue(n);
}
@Override
public String getDescription() {
return "Set NumberPicker value";
}
@Override
public Matcher<View> getConstraints() {
return ViewMatchers.isAssignableFrom(NumberPicker.class);
}
};
}
示例2: setTime
import android.support.test.espresso.matcher.ViewMatchers; //导入方法依赖的package包/类
@SuppressWarnings("SameParameterValue")
public static ViewAction setTime(final int hour, final int minute) {
return new ViewAction() {
@Override
public void perform(UiController uiController, View view) {
TimePicker tp = (TimePicker) view;
if(android.os.Build.VERSION.SDK_INT < 23) {
//noinspection deprecation
tp.setCurrentHour(hour);
//noinspection deprecation
tp.setCurrentMinute(minute);
}
else {
tp.setHour(hour);
tp.setMinute(minute);
}
}
@Override
public String getDescription() {
return "Set the passed time into the TimePicker";
}
@Override
public Matcher<View> getConstraints() {
return ViewMatchers.isAssignableFrom(TimePicker.class);
}
};
}