Tools namespace attribute for showing layout in ViewPager in design time

R. Zagórski picture R. Zagórski · Sep 2, 2016 · Viewed 7.5k times · Source

The tools namespace allows for showing view properties in layout designer.

For example using tools:listItem="@layout/{custom_layout} it is possible to show list with custom row layout in Android Studio designer.

Question is:

Is it possible to show layout inside ViewPager?

Answer

Entreco picture Entreco · Feb 14, 2017

Nope, there is no such attribute.

Currently (Mar 2021) there is:

  • tools:context Intended for: Any root View

  • tools:itemCount Intended for: RecyclerView

  • tools:layout Intended for: fragment

  • tools:listitem / tools:listheader / tools:listfooter Intended for: AdapterView (and subclasses like ListView)

  • tools:showIn Intended for: Any root View in a layout that's referred to by an include

  • tools:menu Intended for: Any root View

  • tools:minValue / tools:maxValue Intented for: NumberPicker

  • tools:openDrawer Intented for DrawerLayout

For resources

  • tools:shrinkMode

  • tools:keep

  • tools:discard

  • tools:locale

Error Handling:

  • tools:ignore Intented for any: Any element

  • tools:targetApi Intended for: Any element

General:

  • tools: instead of android: Intended for: View

Official Android Studio documentation