代码之家  ›  专栏  ›  技术社区  ›  Daniel

如何找到没有任何具体信息的浓缩咖啡元素?

  •  0
  • Daniel  · 技术社区  · 5 年前

    我正在测试是否显示@drawable/ic_wifi(这是所附图片中的wifi符号),但elem没有具体信息

    <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:orientation="vertical"
            android:layout_weight="6.5"
            android:gravity="center">
        <FrameLayout
                android:layout_width="@dimen/home_with_internet_circle_size"
                android:layout_height="@dimen/home_with_internet_circle_size">
    
            <androidx.appcompat.widget.AppCompatImageView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:src="@drawable/bg_home_with_internet_circle" />
    
            <androidx.appcompat.widget.AppCompatImageView
                android:layout_width="wrap_content"
                android:layout_height="@dimen/home_connection_type_icon_size"
                android:layout_gravity="center"
                android:src="@drawable/ic_wifi" />
    
        </FrameLayout>
    

    https://imgur.com/a/5MCZPtI

    0 回复  |  直到 5 年前
        1
  •  0
  •   Michał Mosoń    5 年前

    如果您想测试drawable,那么在应用程序代码中,您需要先标记它,例如: setTag(R.drawable.your_drawable) . 您可以在下面的主题中进行描述:

    Using Espresso to test drawable changes