2012-04-13 3 views
0

"tools.xml"이 올바른 "Tools.java"가 있습니까? 이 "tools.xml"RelativeLayout 내에는 레이아웃 id = @ +/contentLayout이 비어 있습니다.LayoutInflater, RelativeLayout 내 활동이있는 레이아웃 열기

그리고 여러 가지 다른 activits "tool1.java", "tools2.java"... "tool1.xml", "tool2.xml"이 표시가 ...

어떻게 클래스 "를 호출 tool1.java tools.xml ""에있는 RelativeLayout의에서 "

감사

+0

당신이 코드를 붙여 넣을 수를 tool1.xml"예를 들어과는 보여이 " 과거의 충돌이 발생하면 어떤 오류가 발생합니까? 귀하의 충돌 로그 –

답변

0

체크 아웃이

// this is you relativelayout from tool.xml 
    RelativeLayout relativeLayout = (RelativeLayout)findViewById(R.id.contentLayout); 

    LayoutInflater inflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 



        // tool1 is your tool1.xml 
      View tool1 = inflater.inflate(R.layout.tool1, null,false); 

       // here add tool1 to tool.xml in relativelayout 
      relativeLayout.addView(tool1); 
+0

코드가 정확합니다. 버튼을 클릭 할 때 오류가 발생했습니다. – GDawson

+0

오류 로그를 게시하십시오. 어떤 오류가 발생하는지. – Ravi1187342

관련 문제