Programatically I have a RelativeLayout
and TextView
(called title) within it defined as follows:
RelativeLayout layout = new RelativeLayout(this);
final RelativeLayout.LayoutParams parameters_title =
new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
title.setLayoutParams(parameters_title);
layout.addView(title,parameters_title);
I intend to add more textviews
and buttons
later. But for now, I want to "convert" (I am not sure how to put it into words) the RelativeLayout
into a View
in order to put it into WindowManager
. I was trying to use LayoutInflater
like this but it wouldn't work
LayoutInflater layoutInflater =
(LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
myView = layoutInflater.inflate(layout, null );
then the goal is to put myView
into WindowManger
through addView
. How can I get a View
from my RelativeLayout
?