Register.xml file,
<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
Try using the following codes for working with Spinners and this is what worked for me
solo.pressSpinnerItem(0, -5); //selects the item in the spinner
Or
solo.isSpinnerTextSelected(0,"Items") //checks whether the spinner item is selected
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.