정보 표시 줄 및 탭에 대한 xml 레이아웃을 만듭니다. 예 :
infobar textview를 자신의 레이아웃으로 바꿉니다. 상대 레이아웃 "tab_layout"에 주목하십시오. 그것은 탭이 차지할 공간이 될 것입니다. 예 : here을 따르십시오. 링크의 예에서 촬영 :
/* The following are each of the ActionBar.TabListener callbacks */
public void onTabSelected(Tab tab, FragmentTransaction ft) {
// Check if the fragment is already initialized
if (mFragment == null) {
// If not, instantiate and add it to the activity
mFragment = Fragment.instantiate(mActivity, mClass.getName());
ft.add(android.R.id.content, mFragment, mTag);
} else {
// If it exists, simply attach it in order to show it
ft.attach(mFragment);
}
}
변경이 : ft.add(android.R.id.content, mFragment, mTag)
이 ft.add(R.id.tab_layout, mFragment, mTag)
에. 우리는 android.R.id.content 대신 자신의 레이아웃을 사용했음을 주목하십시오.
출처
2013-04-30 04:27:08
jfs
흠. 나는 항상 같은 것을 궁금해했다. 새로운 기능에 관해서는 지식이 많지 않습니다. – user1147223