jeudi 9 mai 2019

scrollTo doesn't work when it is behind a view with alpha

I can't make scrollTo to work when the EditText is behind a LinearLayout with alpha background.

I wanted to avoid uiautomator cause I think it doesn't work sometimes

<RelativeLayout ...>
<ScrollView>
 <LinearLayout>
   <EditText />
   <EditText />
   <EditText />
   <EditText />
   ....
   <EditText android:id="@+id/name" />
 </LinearLayout>
</ScrollView>

<LinearLayout
            android:id="@+id/button_group"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="16dp"
            android:layout_alignParentBottom="true"
            android:background="@color/white80">

</RelativeLayout>

onView(withId(R.id.name)).perform(scrollTo(), typeText(name), closeSoftKeyboard());

It says that it can't find the id name. It works fine if the screen is big but if it's small and the edittext name is behind the button_group which has an alpha backgroound, it always fail.

Aucun commentaire:

Enregistrer un commentaire