我正在制作三条表格,每件都包含一块碎片,现在我想用同一塔布的一条新的裂痕来取代第一个裂痕。 我怎么能用表格来做到这一点?
www.un.org/Depts/DGACM/index_spanish.htm 我的法典——。
Tab_Widget.java
public class Tab_Widget extends TabActivity {
TabHost tabHost;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tab_host);
tabHost = getTabHost();
tabHost.addTab(tabHost.newTabSpec("Tab1")
.setIndicator("Tab1")
.setContent(new Intent().setClass(this, main_activity.class)));
tabHost.addTab(tabHost.newTabSpec("Tab2")
.setIndicator("Tab2")
.setContent(new Intent().setClass(this, second_activity.class)));
tabHost.addTab(tabHost.newTabSpec("Tab3")
.setIndicator("Tab3")
.setContent(new Intent().setClass(this, third_activity.class)));
tabHost.setCurrentTab(0);
}
}
main_active.java
public class main_activity extends FragmentActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mainfragment);
}
}
main_fragment.java
public class main_fragment extends Fragment
{
LinearLayout mLayout;
Button mButton;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mLayout = (LinearLayout) inflater.inflate(R.layout.main_view, null);
mButton = (Button) mLayout.findViewById(R.id.btn);
mButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Fragment mFragment = new third_fragment_view();
FragmentTransaction ft = getFragmentManager().beginTransaction();
// ft.replace(R.id.Maincontainer, mFragment);
ft.replace(R.id.main_fragment, mFragment);
ft.addToBackStack(null);
ft.commit();
}
});
return mLayout;
}
}
<>My XML
<>主要部分>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/Maincontainer"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:name="com.fragment.main_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/main_fragment">
</fragment>
</LinearLayout>
由此可见,这种分裂是毫无疑问的,但它与以前的分裂是重叠的。