gpt4 book ai didi

android - 为什么Android布局中的Fragment元素写的是小写的 'f'?

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:59:52 25 4
gpt4 key购买 nike

所有其他元素都以大写字母开头,如 RelativeLayout、TextView 等。

Fragment 元素总是用作 <fragment ... /> 是否有特殊原因?而不是 <Fragment ... />

最佳答案

在 XML 中定义的 fragment 实际上并不是 View 。指定了完整的 View 名称,或者假定为 android.view找到包裹并找到其余的。但是一个 fragment 只有在包含 android:name 时才真正指定。标签。它就像一个关键字,通常以小写形式书写。因此,Fragment指的是类(class),fragment是 XML 中 fragment 的占位符。

正如 Andrew 在评论中提到的,任何特殊项目,例如 <include><merge>以小写字母书写,因为它们不是 android.view的。

关于android - 为什么Android布局中的Fragment元素写的是小写的 'f'?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21948034/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com