46

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?

R. Zagórski
  • 20,020
  • 5
  • 65
  • 90
  • 2
    I think there is no way to do that. **tools:listitem did not work** for ViewPager as you know. – okarakose Feb 06 '17 at 14:43
  • 3
    Also seems that `tools:listitem` does not work for [`ViewPager2`](https://developer.android.com/reference/androidx/viewpager2/widget/ViewPager2.html). – Michael Osofsky Aug 12 '19 at 16:24

1 Answers1

36

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

Entreco
  • 12,738
  • 8
  • 75
  • 95
  • 2
    `tools:parentTag` could probably be added to this list. Intended for: Merge tag – gMale Sep 11 '17 at 20:16
  • 2
    @Khay no it is not. Reason for downvoting: the question was about showing design-time layout as item of `ViewPager`. `tools:listItem` does not work for that since it is for `AdapterView` subclasses, and `ViewPager` is a direct subclass of `ViewGroup` – Den Drobiazko Sep 13 '18 at 10:07