У меня есть файл header_bar.xml, код которого:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android = "http://schemas.android.com/apk/res/android"
android:layout_width = "fill_parent"
android:layout_height = "wrap_content"
android:background = "@drawable/bar_top"
android:layout_alignParentTop = "true" >
<Button
android:id = "@+id/btn_menu_settings"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_alignParentRight = "true"
android:layout_centerVertical = "true"
android:background = "@drawable/btn_header_settings"
android:text = "@string/menu_btnSetting"
android:layout_marginRight = "20dip"
android:textColor = "#F9F9F6" />
<!-- The text of this button depends of which activity we are, may be change to "Back" or "Menu" -->
<Button
android:id = "@+id/btn_menu_compound"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_alignParentLeft = "true"
android:layout_centerVertical = "true"
android:background = "@drawable/btn_header_menu"
android:text = "@string/menu_btnMenu"
android:layout_marginLeft = "20dip"
android:textColor = "#F9F9F6" />
</RelativeLayout>
Теперь я хочу добавить его в другой файл XML.Я написал этот код:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android = "http://schemas.android.com/apk/res/android"
android:layout_width = "fill_parent"
android:layout_height = "fill_parent"
android:orientation = "vertical" >
<!-- Loading header of this UI which is coded separately -->
<include
android:id="@+id/header"
layout="@layout/header_bar" />
<GridView
android:id="@+id/news_gridview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/header"
android:layout_marginTop="25dip"
android:layout_centerInParent="true"
android:numColumns="2"
android:verticalSpacing="5dp"
android:horizontalSpacing="5dp"
android:background="@drawable/bg" />
<!-- Loading footer of this UI which is coded separately -->
<include layout="@layout/footer_gallery" />
</RelativeLayout>
Компилятор показывает мне следующую ошибку в журнале ошибок: Вы должны указать действительную ссылку на макет.Идентификатор макета @ layout / header_bar недействителен.
Я удивлен, почему он не работает.Я проверил R-файл, и он имел header_bar в своем R.layout.
Любое предложение приветствуется.Спасибо
======================= Обновление
Я только что перезапустил Eclipse и теперьвсе нормально.что это за компилятор?