找到一个<包括>查看由ID?LT、GT、ID

由网友(帅的太过分)分享简介:是否有可能找到一个视图通过ID,如果它是一个:?Is it possible to find a view by id if it's an ?:<...

是否有可能找到一个视图通过ID,如果它是一个:?

Is it possible to find a view by id if it's an ?:

<LinearLayout
  android:layout_width="fill_parent"
  android:layout_height="fill_parent" >

    <include
      android:id="@+id/foo"
      layout="@layout/test" />

  ...

View view = findViewById(R.id.foo);

什么是在这种情况下,意见?它是一个看法?它是否解决到任何布局/测试的顶级元素是?

What is "view" in this case? Is it a view? Does it resolve to whatever the top-level element of "layout/test" is?

感谢

推荐答案

你基本上覆盖顶父视图的ID在包括布局,所以你会得到的是俯视整个的布局和它的内容。该&LT;包括&GT; 标签,实际上,所包含的布局的复制和粘贴。您可以覆盖 ID 标记和布局_ 的任何属性。

You're essentially overwriting the ID of the top-parent view in the layout your including, so what you'll get is the top-view of the entire layout and it's contents. The <include> tag is, in effect, a copy-and-paste of the contained layout. You can override the id tag and any attribute with layout_.

阅读全文

相关推荐

最新文章