You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 30, 2022. It is now read-only.
I have this strange problem which I do not understand probably due to missing knowledge of how slots or macroid in general is working.
I want to wrap a ViewGroup into another ViewGroup after a layout was set in setContentView(...).
This works but when I then want to add a TextView to the new outer ViewGroup it fails in the following way: The TextView becomes the first child of the new outer ViewGroup.
However it should be the second (last) child of the new outer ViewGroup since I add it to the new outer ViewGroup after I add the old outer ViewGroup to the new outer ViewGroup.
var newOuter = slot[FrameLayout]
var outer = slot[LinearLayout]
override def onCreate(savedInstanceState: Bundle) = {
super.onCreate(savedInstanceState)
setContentView(getUi(l[LinearLayout]() <~ matchParent <~ wire(outer)))
getUi( l[FrameLayout]() <~ matchParent <~ wire( newOuter ) )
outer.map { view ⇒
view.getParent() match {
case parent: ViewGroup ⇒
parent.removeView( view )
parent.addView( newOuter.get )
case _ ⇒ //
}
newOuter.get.addView( view )
newOuter.get.addView( getUi( w[TextView] <~ text( "This TextView should be the last child of newOuter: FrameLayout" ) ) )
}
}