Android RatingBar在Actionbar.Tab片段中具有损坏的布局
我有一个关于Android中标准评级条控件的问题。我正在使用Android Studio 0.5.8和HTC进行调试。分级栏显示在listView控件中。 在自定义适配器中,我设置了以下值:Android RatingBar在Actionbar.Tab片段中具有损坏的布局,android,android-layout,ratingbar,Android,Android Layout,Ratingbar,我有一个关于Android中标准评级条控件的问题。我正在使用Android Studio 0.5.8和HTC进行调试。分级栏显示在listView控件中。 在自定义适配器中,我设置了以下值: myRatingbar = (RatingBar) row.findViewById(R.id.myRatingbar); myRatingbar.setRating(product.getRating()); 我使用以下代码添加RatingBar控件: <RatingBa
myRatingbar = (RatingBar) row.findViewById(R.id.myRatingbar);
myRatingbar.setRating(product.getRating());
我使用以下代码添加RatingBar控件:
<RatingBar
style = "?android:attr/ratingBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars = "5"
android:stepSize="0.1"
android:id="@+id/myRatingbar"
android:layout_row="2"
android:layout_column="4"/>
将listview添加到正常活动时,一切正常。当我将listview添加到Actionbar.tab中的片段时,它会破坏ratingbar的布局。当我在一项活动中设置等级3.0时,它会显示三星。如果我在片段内设置评级,它将显示我的五颗星,并在评级栏底部显示重叠的星星
活动->列表视图,分级栏正常
Activity->Actionbar.Tab->Fragment->Listview和分级栏如下所示:
我使用相同的代码和layout.xml,但只在ActionBar.Tab->fragment中使用,而不是在activity中使用。
我花了很多时间来解决这个问题,但确实找不到根本原因。我遵循一些教程,在这里搜索stackoverflow以获得答案。我还尝试添加具有相同结果的自定义actionbar图像
由于这是我的第一篇文章,我不够精确,请告诉我您需要哪些信息来帮助我解决问题
编辑:如果星星是空的(没有评级),则所有内容都呈现正确。请参见此图像->您好,有人有想法吗?