您的位置:首页 > 移动开发 > Android开发

关于android的id

2014-05-06 14:14 288 查看

当引用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>
 

 

 

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: