2012-02-10 5 views
0

다른 조각이 숨겨져있을 때 조각의 크기를 어떻게 조정합니까? 즉, 조각 "A"(또는 listFragment)를 제거하거나 숨길 때 해당 공간은 비어 있습니다. 조각 "A"가 전체 화면을 차지하도록 조각 "B"가있는 공간을 크기를 조정하고 채우려면 나머지 조각 "B"가 필요합니다. 코드 예제에 대한 도움을 주시면 감사하겠습니다. Thnx조각 크기 조정 방법?

답변

0
android.support.v4.app.Fragment frag = getSupportFragmentManager().findFragmentById(R.id.page_list); 
android.support.v4.app.FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); 

    if(this.isVisible){ 
     this.isVisible=false; 
     ft.hide(frag); 
    }else{ 
     this.isVisible=true; 
     ft.show(frag); 
    } 
    ft.commit(); 

이 코드는 R.id.page_list ID와 ListFragment를 숨길 것이며, otherone (내용이) 자동으로 크기가 조정됩니다.