Android Studio,Intellij 13:在布局预览中使用Log.i

Android Studio,Intellij 13:在布局预览中使用Log.i,android,android-layout,intellij-idea,android-studio,intellij-13,Android,Android Layout,Intellij Idea,Android Studio,Intellij 13,这个问题与Intellij IDEA 13或Android Studio上的Android开发有关 我创建了一个非常简单的自定义视图: public class CustomView extends View{ public CustomView(Context context, AttributeSet attrs) { super(context, attrs); Log.i("TAG", "Hello Preview!"); } } 然

这个问题与Intellij IDEA 13或Android Studio上的Android开发有关

我创建了一个非常简单的自定义视图:

public class CustomView extends View{

    public CustomView(Context context, AttributeSet attrs) {
        super(context, attrs);

        Log.i("TAG", "Hello Preview!");
    }
}
然后我将其嵌入到布局中:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.example.myapplication.app.CustomView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#FFFF00"/>

</FrameLayout>

我现在可以在布局预览窗口中看到视图:

如果我在设备或模拟器上运行应用程序,我希望在logcat窗口中看到文本“Hello Preview!”,但如果我使用预览模式,则日志为空:

有没有办法记录在预览模式下运行的自定义视图的输出?我不希望在设备或模拟器上运行应用程序只是为了从视图中查看日志输出


我不在乎解决方案是否涉及Log.I。您可以建议使用其他日志功能,甚至是自定义插件或库。

没有连接设备,因此没有人向您发送
Log.i
。如果您在emulator或电话上运行该程序,输出将在那里

谢谢您的回答。我了解记录在设备或模拟器上的工作方式。我将对问题进行编辑以使其更清晰。好的,我进行了编辑以澄清问题。谢谢你的帮助。