我正在尝试使应用测试自动化。在屏幕之一中,我有项目列表,我想单击指定的项目和关联的图像。所有项目均指定为RecyclerView。我只能点击第一项。
我正在使用Kotlina nd UiAutomatore。我有UiDevice对象处理程序,只能单击第一项。
public void drawTexture (Canvas canvas) {
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.codi_texture);
BitmapShader fillBMPshader = new BitmapShader(bitmap, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
Paint paint = new Paint();
paint.setShader(fillBMPshader);
int middle = mFramingRect.height() / 2 + mFramingRect.top;
middle = middle + cntr;
if ((cntr < 300) && (!goingup)) {
canvas.drawRect(mFramingRect.left,
mFramingRect.top,
mFramingRect.right,
middle,
paint);
cntr = cntr + 4;
}
if ((cntr >= 300) && (!goingup)) goingup = true;
if ((cntr > -300) && (goingup)) {
canvas.drawRect(mFramingRect.left,
mFramingRect.top,
mFramingRect.right,
middle,
paint);
cntr = cntr - 4;
}
if ((cntr <= -300) && (goingup)) goingup = false;
}
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black">
<TextView
android:id="@+id/activity_user_list_header"
android:layout_width="0dp"
android:layout_height="55dp"
android:background="@color/settingsSectionBackground"
android:gravity="center_vertical"
android:paddingStart="36dp"
android:text="@string/activity_user_list_users_label"
android:textColor="@color/settingsSectionTitle"
android:textSize="12sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/activity_user_list_add_new_user" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/activity_user_list_recycler"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/activity_user_list_header" />
</androidx.constraintlayout.widget.ConstraintLayout>
只需删除第一项