【问题标题】:Android Studio Preview Window - Render ListView Item TemplateAndroid Studio 预览窗口 - 渲染 ListView 项目模板
【发布时间】:2014-05-21 09:48:27
【问题描述】:

在 Android Studio 中,在视图的文本模式下工作时,右侧的“预览”窗口处于活动状态。将列表视图添加到视图时,它会呈现默认列表。我有一个在运行时使用的自定义模板,但是否可以让预览窗口在设计时显示我的模板?

谢谢

【问题讨论】:

    标签: android-listview android-studio


    【解决方案1】:

    将工具命名空间添加到您的 xml 布局中:

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

    接下来你可以像这样指定列表项布局:

    tools:listitem="@layout/mycustom_listitem"
    

    完整示例:

    <ListView
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/lv_contactslist"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        tools:listitem="@layout/listitem_contact" />
    

    有关图形方式,请查看this stackoverflow post

    【讨论】:

      猜你喜欢
      • 2015-08-27
      • 2020-07-24
      • 2014-12-23
      • 1970-01-01
      • 2016-08-06
      • 2015-05-25
      • 2019-10-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多