Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio layout previews for Listview + Gridview

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.

like image 286
sigmabeta Avatar asked Nov 06 '13 17:11

sigmabeta


1 Answers

From graphical editor:

Adding list item preview

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

like image 136
Sergii Pechenizkyi Avatar answered Nov 13 '22 22:11

Sergii Pechenizkyi