landryshuai / robotium

Automatically exported from code.google.com/p/robotium
0 stars 0 forks source link

Not able to click on ImageView in the list view list item #671

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Create a listview in which each row contains views as shown in the code below.
2.using robotium click on ImageView with id (@+id/rcOverflow).
3.

What is the expected output? What do you see instead?
It should click on overflow menu of the first listview Item

What version of the product are you using? On what operating system?
robotium-solo-5.3.1.jar

Please provide any additional information below.
I am testing using apk, R.id values are not showing.

what I tried
android.widget.ListView listView0 = (android.widget.ListView) 
solo.getView(android.widget.ListView.class, 0);
        View v = listView0.getChildAt(0);
        solo.clickOnView(v);//Just clicks on the first row
solo.clickInList(5, 0);//Clicks on 5 the row in the list.

But I want to click on the overflow menu(imageView) present in the first row of 
the listview.

This is my layout for each row in the list, I want to click on last 
Imageview(@+id/rcOverflow).

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="left"
    android:paddingBottom="10dp"
    android:paddingTop="5dp">

    <ImageView
        android:id="@+id/rcCircle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignWithParentIfMissing="true"
        android:layout_alignParentTop="true" />

    <TextView
        android:id="@+id/rcTime"
        android:layout_width="80dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dp"
        android:gravity="right"
        android:maxLines="1"
        android:textColor="#ffffff"
        android:textSize="13sp" />

    <RelativeLayout
        android:id="@+id/rsBubble"
        android:layout_width="280dp"
        android:layout_height="wrap_content"
        android:layout_alignWithParentIfMissing="true"
        android:layout_below="@id/recordsMonthHeader"
        android:paddingBottom="16dp"
        android:paddingTop="16dp">

        <ImageView
            android:id="@+id/rcImage"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:adjustViewBounds="true"
            android:layout_alignParentTop="true"
            android:visibility="gone"
            android:layout_marginLeft="3dp"
            android:layout_marginRight="4dp"/>

        <TextView
            android:id="@+id/rcFilename"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:layout_alignParentLeft="true"
            android:layout_marginLeft="10dp"
            android:textColor="#000000"
            android:maxLines="2"
            android:ellipsize="end"
            android:textSize="15sp" />

        <TextView
            android:id="@+id/rcDuration"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_below="@id/recordsFilename"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="2dp"
            android:textColor="#a09f9f" />

        <ImageView
            android:id="@+id/records_location_image"
            android:layout_width="12dp"
            android:layout_height="12dp"
            android:layout_alignBottom="@id/recordsDuration"
            android:layout_marginBottom="4dp" />

        <TextView
            android:id="@+id/rcLocation"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@id/recordsDuration"
            android:layout_marginBottom="1dp"
            android:layout_marginLeft="3dp"
            android:layout_marginTop="2dp"
            android:ellipsize="end"
            android:lines="1"
            android:textColor="#a09f9f"
            android:textSize="12sp"
            android:visibility="gone" />

        <TextView
            android:id="@+id/rcTag"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_below="@id/recordsDuration"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="3dp"
            android:textColor="#a09f9f"
            android:textSize="12sp"
            android:visibility="gone" />

        <ImageView
            android:id="@+id/rcOverflow"
            android:layout_width="32dp"
            android:layout_height="32dp"
            android:layout_below="@+id/recordsImage"
            android:layout_alignParentRight="true"
            android:layout_alignWithParentIfMissing="true"
            android:background="?android:attr/selectableItemBackground"
            android:src="@drawable/overflow" />

    </RelativeLayout>

</RelativeLayout>

Original issue reported on code.google.com by shiva...@triveous.com on 10 Apr 2015 at 9:11

GoogleCodeExporter commented 9 years ago
You can use getView(String id) if you don't have the source code. 

Original comment by renasr...@gmail.com on 13 Apr 2015 at 6:53