[英]How to use spinner in robotium?
Register.xml file, Register.xml文件,
<RelativeLayout
android:id="@+id/spinner_relay"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="@id/fd_register_header"
android:layout_marginBottom="@dimen/dm_5dp"
android:layout_marginLeft="@dimen/dm_10dp"
android:layout_marginRight="@dimen/dm_10dp"
android:layout_marginTop="@dimen/dm_5dp"
android:background="@drawable/spinner_background" >
<TextView
android:id="@+id/fp_spinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:drawablePadding="@dimen/dm_10dp"
android:drawableRight="@drawable/icondown"
android:gravity="left|center"
android:padding="@dimen/dm_10dp"
android:text="Select city"
android:textColor="@color/white"
android:textSize="@dimen/dm_18sp" />
</RelativeLayout>
if i used this code, 如果我使用此代码,
int pos = solo.getCurrentSpinners().get(0).getSelectedItemPosition();
getting error, 出现错误,
cannot resolve symbol getCurrentSpinner
无法解析符号getCurrentSpinner
Try using the following codes for working with Spinners and this is what worked for me 尝试使用以下代码与Spinners一起使用,这对我有用
solo.pressSpinnerItem(0, -5); //selects the item in the spinner
Or 要么
solo.isSpinnerTextSelected(0,"Items") //checks whether the spinner item is selected
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.