0
如何在其他片段被隐藏时调整片段大小?换句话说,当我删除或隐藏片段“A”(或listFragment)时,该空间是空的。我需要剩余的片段“B”来调整大小并填充片段“A”所在的空间,使片段“B”占据整个屏幕。任何帮助代码示例将不胜感激。 Thnx片段大小如何?
如何在其他片段被隐藏时调整片段大小?换句话说,当我删除或隐藏片段“A”(或listFragment)时,该空间是空的。我需要剩余的片段“B”来调整大小并填充片段“A”所在的空间,使片段“B”占据整个屏幕。任何帮助代码示例将不胜感激。 Thnx片段大小如何?
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,另一个(content)将自动调整其自身大小。