本文整理匯總了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);
}
};
}