Listview + Gridview 的 Android Studio 布局预览 [英] Android Studio layout previews for Listview + Gridview

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

问题描述

有没有办法让 Android Studio 的布局预览屏幕使用实际运行时布局的占位符视图填充 GridView 或 ListView?

换句话说,我不想看到Item 1/Sub Item 1"视图的网格,我希望能够在某处设置@layout/foo 并将其显示在那里.

解决方案

来自图形编辑器:

来自 xml:

注意:注意这个问题:https://stackoverflow.com/a/12188118/624706>

Is there a way to get Android Studio's layout preview screen to populate a GridView or ListView with placeholder views of the actual runtime layout?

In other words, I don't want to see a grid of "Item 1/ Sub Item 1" views, I want to be able to set @layout/foo somewhere and have it show up in there.

解决方案

From graphical editor:

From xml:

<GridView
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:numColumns="2"
        tools:listitem="@layout/grid_item"/>

Note: pay attention to this isse: https://stackoverflow.com/a/12188118/624706

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

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