大佬教程收集整理的这篇文章主要介绍了android – 为什么eclipse突出显示R.id.tabhost?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我看的每个教程都有TabHost tabs =(TabHost)findViewById(R.id.tabhost),每次我都包含这行id tabhost是hightlighted,错误:tabhost无法解析或不是字段.
recipe_list.java:
TabHost tabs=(TabHost)findViewById(R.id.tabhost); tabs.setup(); TabHost.TabSpec spec=tabs.newTabSpec("tag1"); spec.setContent(R.id.tab1); spec.seTinDicator("Clock"); tabs.addTab(spec); spec=tabs.newTabSpec("tag2"); spec.setContent(R.id.tab2); spec.seTinDicator("Button"); tabs.addTab(spec);
recipe_list.xml,我在每个标签中都有列表视图:
<TabHost android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TabWidget android:id="@android:id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" > </TabWidget> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:id="@+id/tab1" android:layout_width="match_parent" android:layout_height="match_parent" > <ListView android:id="@+id/listView1" android:layout_width="match_parent" android:layout_height="fill_parent" android:layout_weight="1" > </ListView> </LinearLayout> <LinearLayout android:id="@+id/tab2" android:layout_width="match_parent" android:layout_height="match_parent" > <ListView android:id="@+id/listView2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" > </ListView> </LinearLayout> <LinearLayout android:id="@+id/tab3" android:layout_width="match_parent" android:layout_height="match_parent" > </LinearLayout> </FrameLayout> </LinearLayout> </TabHost>
以上是大佬教程为你收集整理的android – 为什么eclipse突出显示R.id.tabhost?全部内容,希望文章能够帮你解决android – 为什么eclipse突出显示R.id.tabhost?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。