adding a shape using java code, in middle of a xml layout?

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

adding a shape using java code, in middle of a xml layout?

Postby shailaja » Tue Jan 04, 2011 5:21 am

hi all,


As my requirement i need to add a shape in middle of an existed xml layout using java code. In that xml I have a graph title at the top, under that i have some text details. Up to now am able to draw that shape under the graph title i.e where i want to place in xml, by using the following code.


linear =(LinearLayout) findViewById(R.id.linear);
RectangleView aView = new RectangleView(this);
linear.addView(aView);

But the problem is, after adding the shape, remaining ui of that xml (other textual details) is gone. I want to place that thing also in my xml. If any one aware of this, can you please suggest me to fix this. any responce will be appreciated.

thanks in advance.
shailaja
Developer
Developer
 
Posts: 40
Joined: Fri Aug 06, 2010 8:00 am

Top

Re: adding a shape using java code, in middle of a xml layou

Postby shailaja » Fri Jan 07, 2011 5:30 am

Hi
Yes, I got this by using a fresh linear layout for adding the shape view.

thanks all
shailaja
Developer
Developer
 
Posts: 40
Joined: Fri Aug 06, 2010 8:00 am

Top

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 5 guests