Android Studio 预览片段 [英] Android Studio preview fragment

查看:35
本文介绍了Android Studio 预览片段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下布局文件:

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:layout_height="match_parent">

    <TextView
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:text="@string/what_did_you_eat"/>

    <FrameLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        tools:context=".AddFoodActivity"
        tools:ignore="MergeRootFrame"
        />

</LinearLayout>

FrameLayout 将包含一个动态添加的 fragment,有没有办法在编辑器中预览 fragment ?就像我们在使用带有 tools:layout 属性的 标签时可以做的那样?

FrameLayout will contain a dynamic added fragment, is there a way to preview in the editor the fragment ? Like we can do when using a <fragment> tag with the tools:layout attribute ?

推荐答案

虽然它很有用,但 目前的工具文档表明这是可能的.

While it would be useful, there's nothing in the current tools docs that suggests this is possible.

这篇关于Android Studio 预览片段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆