1

I have the xml layout, and I want to create View from it - I need do it programatically. Is it possible?

user1023177
  • 641
  • 3
  • 10
  • 18
  • Here you [go](http://stackoverflow.com/questions/2335813/how-to-inflate-one-view-with-an-layout/2335867#2335867) – Adil Soomro Nov 04 '11 at 10:33

2 Answers2

3

yes It is. you have to use the inflater service like

        LayoutInflater li=(LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        yourview=li.inflate(R.layout.yourlayout, null);
Blackbelt
  • 156,034
  • 29
  • 297
  • 305
0

put your xml in layout folder with some name say x.

Use getViewInflate().inflate(R.layout.x, null, null) to create the view.

user550925
  • 96
  • 2