当引用Android的资源ID(非本地资源ID)时,必须机上android包名,使用TabHost控件时就要如此操作:

When referencing an Android resource ID, you do not need the plus-symbol, but must add the android package namespace, like so:

引用 android:id="@android:id/empty"


With the android package namespace in place, we're now referencing an ID from the android.R resources class, rather than the local resources class.

TabHost的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="match_parent"    android:layout_height="match_parent" >    <LinearLayout        android:layout_width="match_parent"        android:layout_height="match_parent"        android:orientation="vertical"        android:padding="5dp" >        <TabWidget            android:id="@android:id/tabs"            android:layout_width="match_parent"            android:layout_height="wrap_content" />        <FrameLayout            android:id="@android:id/tabcontent"            android:layout_width="match_parent"            android:layout_height="match_parent"            android:padding="5dp" />    </LinearLayout></TabHost>

更多相关文章

  1. Android中的五大布局
  2. android 控件属性大全
  3. 【Android】Android控件之Seekbar拖动条的使用
  4. Android常用布局属性
  5. 周记:Class4
  6. Android(安卓)RelativeLayout 属性
  7. android找不到图片资源
  8. Android如何引用其他工程
  9. android linearlayout 把控件view置底部(放在页面最下方)

随机推荐

  1. Android(安卓)基本Dialog和自定义Dialog
  2. Android之MediaPlayer
  3. Android(安卓)基本Dialog和自定义Dialog
  4. android 进程间通信示例
  5. Eclipse build Android时不生成apk问题解
  6. Android(安卓)系统跳转实现分享功能(如 微
  7. android 设计比较美观的登录界面
  8. Android之Intent的基本使用
  9. Android(安卓)Layout XML属性
  10. Android(安卓)Permission大全