【发布时间】:2013-12-09 10:46:18
【问题描述】:
我有一个像这样扩展 Fragment 的类:
public class Fragment_Coupons extends Fragment {
TabHost tabHost;
TabHost.TabSpec spec;
public Fragment_Coupons() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_coupon, container,
false);
return rootView;
}
}
这个的 XML 文件是:
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</TabHost>
现在我想得到
tabHost = getTabHost();
这给了我一个错误。
【问题讨论】:
标签: android android-fragments tabs