2

In Android Studio, while working in Text mode for a view i have the "Preview" window active to the right. When adding a listview to the view it renders a default list. I have a custom template which is used at runtime but is it possible to have the preview window show me my template at design time?

Thanks

Steven Yates
  • 2,400
  • 3
  • 30
  • 58

1 Answers1

0

Add the tools namespace to your xml layout:

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

next you can specify the listitem layout like this:

tools:listitem="@layout/mycustom_listitem"

Full example:

<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" />

For a graphical way, have a look at this stackoverflow post

Community
  • 1
  • 1
Jeroen Mols
  • 3,436
  • 17
  • 24