Android RatingBar怪异:每当我在布局中添加一个RatingBar,一堆生成的标签,抛出错误,就好像它们是未定义的一样

Android RatingBar怪异:每当我在布局中添加一个RatingBar,一堆生成的标签,抛出错误,就好像它们是未定义的一样,android,android-widget,Android,Android Widget,每当我在布局中使用RatingBar视图时,我会突然遇到各种编译错误。我使用的是安卓2.0,但我也尝试过2.0.1和2.1,但没有乐趣。我还收到一条消息:着色器“android.graphics.BitmapShader”在布局编辑器中不受支持, 还有一个奇怪的警告,可能相关,也可能无关: 警告:忽略匿名内部类的InnerClasses属性,该匿名内部类没有关联的EnclosingMethod属性 我尝试在tablelayout内部和外部使用RatingBar,但其行为方式相同。这是非常令人困惑

每当我在布局中使用RatingBar视图时,我会突然遇到各种编译错误。我使用的是安卓2.0,但我也尝试过2.0.1和2.1,但没有乐趣。我还收到一条消息:
着色器“android.graphics.BitmapShader”在布局编辑器中不受支持,
还有一个奇怪的警告,可能相关,也可能无关:
警告:忽略匿名内部类的InnerClasses属性,该匿名内部类没有关联的EnclosingMethod属性

我尝试在tablelayout内部和外部使用RatingBar,但其行为方式相同。这是非常令人困惑和沮丧的。如果可以的话,请帮忙

真诚地, 射线

以下是XML:

<?xml version="1.0" encoding="utf-8"?>
  <LinearLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:orientation="vertical"
   >

<TextView
  android:id="@+id/gi_name"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:layout_gravity="center_horizontal"
  android:padding="10px" />
<TextView
  android:id="@+id/gi_description"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:padding="4px" />

<TableLayout
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:padding="4px">

  <TableRow
    android:layout_height="wrap_content"
    android:layout_width="fill_parent">
    <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:gravity="right"
      android:text="@string/GameInfoVerificationLabelText" />
    <TextView
      android:id="@+id/gi_verification"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content" />
  </TableRow>

  <TableRow
    android:layout_height="wrap_content"
    android:layout_width="fill_parent" >
    <TextView
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:gravity="right"
      android:text="@string/GameInfoPlayerRatingLabel" />
    <TextView
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:text="  " />
  </TableRow>

  <TableRow
    android:layout_height="wrap_content"
    android:layout_width="fill_parent" >
    <RatingBar
      android:id="@+/gi_player_rating"
      style="?android:attr/ratingBarStyleSmall"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_span="2"
      android:isIndicator="true"
      android:numStars="5"
      android:rating="3"
      android:stepSize="1"
      android:layout_gravity="center_vertical"
      />
  </TableRow>

  <TableRow
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
  >
    <TextView
      android:id="@+id/gi_times_played_label"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:gravity="right"
      android:text="@string/GameInfoTimesPlayedLabel" />
    <TextView
      android:id="@+id/gi_times_played"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:text="999" />
  </TableRow>


</TableLayout>

<TextView
  android:id="@+id/gi_win_criteria_label"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:text="@string/GameInfoWinCriteriaLabelText"
  android:padding="4px" />

<TableLayout
  android:id="@+id/gi_win_criteria_table"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:padding="1px"
>
</TableLayout>

</LinearLayout>

您的分级栏的
android:id
属性似乎很奇怪:

android:id="@+/gi_player_rating"
你大概是说:

android:id="@+id/gi_player_rating"

尝试修复该问题,看看问题是否仍然存在。

您可能应该在尝试添加分级栏的文件中发布XML。我没有使用布局编辑器(它对我来说从来都不是很好),但我已经成功地在布局XML中使用了分级栏。谢谢你的建议。我已将XML添加到原始帖子中。我已经注意到布局编辑器有一些非常严重的缺陷。它似乎也不适用于相对布局。遗憾的是,使用emulator进行测试需要花费相当长的时间。我之所以知道它是评级条,是因为我尝试注释掉xml的每一部分,唯一一次解决问题的是注释掉评级条。我也试着把它移到桌子外面,但是没有用。哦,我现在得去拍我的额头了。非常感谢。有时候你只需要另一双眼睛。我的丢在某个抽屉里了。