title: Using Anko Layouts in Fragments
body: <p>I have created the following layout:</p>
  
  <pre><code>class ExploreUI&lt;T&gt; : AnkoComponent&lt;T&gt; {
  
      override fun createView(ui: AnkoContext&lt;T&gt;): View {
  
          return with(ui) {
              frameLayout {
                  val loadingIndicator = include&lt;View&gt;(R.layout.loading_indicator)
  
                  val content = nestedScrollView {
                      isFillViewport = true
                      visibility = View.GONE
  
                      verticalLayout {
  
                          /** New Releases */
                          themedTextView(R.string.new_releases, theme = R.style.DarkThemeHeaderText) {
                              id = R.id.releasesHeader
                          }.lparams {
                              padding = dip(10)
                          }.apply {
  
                          }
  
                          val releasesRecycler = recyclerView {
                          }.lparams(width = matchParent, height = wrapContent)
  
                          include&lt;View&gt;(R.layout.show_more)
  
                          /** Recommended playlists */
                          themedTextView(R.string.recommended_playlists, theme = R.style.DarkThemeHeaderText) {
                              id = R.id.releasesHeader
                          }.lparams {
                              padding = dip(10)
                          }.apply {
  
                          }
  
                          val playlistsRecycler = recyclerView {
                          }.lparams(width = matchParent, height = wrapContent)
  
                          include&lt;View&gt;(R.layout.show_more)
  
                          /** Recently played */
                          themedTextView(R.string.recently_played, theme = R.style.DarkThemeHeaderText) {
                              id = R.id.releasesHeader
                          }.lparams {
                              padding = dip(10)
                          }.apply {
  
                          }
  
                          val recentsRecycler = recyclerView {
                          }.lparams(width = matchParent, height = wrapContent)
  
                          include&lt;View&gt;(R.layout.show_more)
  
                          /** Popular artists */
                          themedTextView(R.string.popular_artists, theme = R.style.DarkThemeHeaderText) {
                              id = R.id.releasesHeader
                          }.lparams {
                              padding = dip(10)
                          }.apply {
  
                          }
  
                          val artistsRecycler = recyclerView {
                          }.lparams(width = matchParent, height = wrapContent)
  
                          include&lt;View&gt;(R.layout.show_more)
  
                          /** Recommended tracks */
                          themedTextView(R.string.most_recommeneded, theme = R.style.DarkThemeHeaderText) {
                              id = R.id.releasesHeader
                          }.lparams {
                              padding = dip(10)
                          }.apply {
  
                          }
  
                          val recommendedTracksRecycler = recyclerView {
                          }.lparams(width = matchParent, height = wrapContent)
  
                          include&lt;View&gt;(R.layout.show_more)
  
                          /** All time hits */
                          themedTextView(R.string.based_on_your_listening, theme = R.style.DarkThemeHeaderText) {
                              id = R.id.releasesHeader
                          }.lparams {
                              padding = dip(10)
                          }.apply {
  
                          }
  
                          val hitsRecycler = recyclerView {
                          }.lparams(width = matchParent, height = wrapContent)
  
                          include&lt;View&gt;(R.layout.show_more)
                      }
                  }
              }
          }
      }
  
  }
  </code></pre>
  
  <p>I then inflate the layout on <code>onCreateView</code> as follows:</p>
  
  <pre><code>override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? =
              ExploreUI().createView(AnkoContext.Companion.create(activity as AppCompatActivity, this))
  </code></pre>
  
  <p>The problem I have is accessing the components defined in my UI class. How do I reference them from my Fragment?</p>