我有一个可绘制的图标,用作导航标题上的导航按钮。可绘制图标存储在XML文件navigation_header.xml
中
我正在尝试进行浓咖啡测试,以验证导航按钮的可单击性,但可绘制对象本身没有ID(无法通过withId R.id.id_name
ID: navigation_heading
我要做什么:
onView(allOf(withId(R.id.*navigation_heading*), isDisplayed())) --> does not work
查看可绘制对象的层次结构(导航按钮):
AppCompatImageButton
{id=-1, visibility=VISIBLE, width=154, height=154, has-focus=false, has-focusable=false, has-window-focus=true, **is-clickable=true**, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=androidx.appcompat.widget.Toolbar$LayoutParams@c41ab7f, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0}