Android RatingBar weirdness: Whenever I add a RatingBar to my layout, a bunch of the generated tags, throw off errors as if they are undefined
Whenever I use a RatingBar view in my layout, I suddenly get all kinds of compile errors. I'm using Android 2.0, but I've also tried 2.0.1, and 2.1, without joy. I also get a message: Shader 'android.graphics.BitmapShader' is not supported in Layout Editor
,
warning: Ignoring InnerClasses attribute for an anonymous inner class that doesn't come with an associated EnclosingMethod attribute
I've tried using the RatingBar both within a tablelayout and outside it, but it behaves the same way. This is very puzzling and frustrating. Please help if you can.
Sincerely, Ray
Here's the 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"
>
<开发者_Go百科/TableLayout>
</LinearLayout>
The android:id
attribute of your RatingBar seems odd:
android:id="@+/gi_player_rating"
Presumably you meant:
android:id="@+id/gi_player_rating"
Try fixing that and see if the problem persists.
精彩评论