gpt4 book ai didi

android - 有没有办法预览在 IntelliJ IDEA 12 的另一个 View 中使用的 fragment ?

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:32:06 36 4
gpt4 key购买 nike

我最近从 Eclipse 切换到了 IntelliJ IDEA 12。是否有一种好的方法来预览在另一个 xml 布局文件中使用的 fragment ?

在 Eclipse 中,有一种方法可以指定我正在使用的 fragment ,这非常有用。

enter image description here

编辑(澄清):我指的是查看在另一个 xml 布局中引用的 fragment 的能力。假设我正在创建一个配置文件屏幕 (activity_profile.xml) 并想要包含一个包含图片、名称等的 fragment (fragment_pic.xml)。当我在 activity_profile.xml 中包含该 fragment 时,它不会显示在activity_profile 布局的预览。它只显示“

最佳答案

您可以在 XML 中执行此操作:

<fragment
android:name="com.yourpackage.yourapp.yourfragment"
android:layout_height="match_parent"
android:layout_width="match_parent"
tools:layout="@layout/fragment_layout"
</fragment>

tools 命名空间在顶 View 中由此限定,与 xmlns:android 命名空间限定符相同:

xmlns:tools="http://schemas.android.com/tools"

从 Eclipse 迁移到 Android Studio 预览版后,我也遇到了同样的问题,不过幸运的是,Android Studio 建议您在检查定义时在 XML 中提供它,非常方便:)

关于android - 有没有办法预览在 IntelliJ IDEA 12 的另一个 View 中使用的 fragment ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15626302/

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