[英]Android Rating bar Invisible
以下是我的評分欄代碼
<RatingBar
android:id="@+id/ratingBarU"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:layout_weight="1"
android:numStars="10"
android:progressTint="#FBE140"
android:stepSize="1" />
我遇到的問題是,當我將樣式設置為時,
style="?android:attr/ratingBarStyleSmall"
當我嘗試
style="?android:attr/ratingBarStyleIndicator"
評分欄顯示所有 10 顆星,但在我的模擬器上運行時無法點擊。 我想要的只是讓我的評分欄顯示所有 10 顆星並適合屏幕尺寸請幫助! 我對 android 開發非常陌生
想想你在LinearLayout(Horizontal)內使用。 你能在垂直線性布局中使用這個代碼嗎
<RatingBar
android:id="@+id/ratingBarU"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?android:attr/ratingBarStyleIndicator"
android:numStars="10"
android:progressTint="#FBE140"
android:stepSize="1" />
使layout_height
wrap_content不使用特定的 dp 值,我也不明白您為什么使用layout_weight
,因為您將特定高度設置為45dp
(它應該是 wrap_content)並將寬度設置為 wrap_content。 您的評分欄應如下所示
<RatingBar
android:id="@+id/ratingBarU"
style="?android:attr/ratingBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="10"
android:progressTint="#FBE140"
android:stepSize="1" />
Output
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.