2011-06-22 43 views
2

我有一個對話框,其中包含一個EditText,一個RatingBar和兩個按鈕。評級欄layout_width已被告知wrap_content,但它將星星展開,以便很好地適應編輯文本和按鈕與佈局參數之間的空間。這不會是一個問題,但我已經告訴它要增加半個星。選定的星形值是通過截取填充的圖像實時繪製的,可以對你想要的星形的任何部分進行評分,但似乎間距正在被包括在內,使得我的半個星形看起來像三分之一或四分之一星形(特別是在較低的dpi屏幕上,它們使星星自動變得更小),而整個星星看起來不錯。如何阻止Android評分欄蔓延?

編輯:我注意到,在所有情況下,左邊的星星顯示的這個症狀遠比右邊的星星要少。我的意思是,左邊的半星可能只是略微偏離,但右邊的半星將是最遠的。這發生在我測試過的所有手機上。結束編輯。

我沒有訪問到手機它是最明顯的,但你仍然可以在這裏看到的效果: A picture of a dialog with three full stars, a half star that isn't filled enough, and an empty star http://img534.imageshack.us/img534/1071/device2x.png

第四星倒不半滿的方式,它只能越來越糟上一些其他手機。

這是我的佈局XML:

<?xml version="1.0" encoding="UTF-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" android:layout_height="wrap_content"> 
<LinearLayout android:orientation="vertical" 
    android:layout_width="fill_parent" android:layout_height="wrap_content" 
    android:padding="10dp"> 
    <EditText android:id="@+id/reviewWriteText" 
     android:layout_width="fill_parent" android:layout_height="wrap_content" 
     android:ems="13"/> 
    <RatingBar android:id="@+id/reviewStars" 
     android:layout_width="wrap_content" android:layout_height="wrap_content" 
     android:numStars="5" android:stepSize="0.5" /> 
    <LinearLayout android:layout_width="fill_parent" 
     android:layout_height="fill_parent" android:orientation="horizontal"> 
     <Button android:id="@+id/reviewWriteAccept" android:text="Accept" 
      android:layout_width="fill_parent" android:layout_height="fill_parent" 
      android:layout_weight="1" /> 
     <Button android:id="@+id/reviewWriteCancel" android:text="Close" 
      android:layout_width="fill_parent" android:layout_height="fill_parent" 
      android:layout_weight="1" /> 
    </LinearLayout> 
</LinearLayout> 
</ScrollView> 

回答

-2

也許你可以將它添加到您的清單文件

<uses-sdk android:minSdkVersion="4" 
    android:targetSdkVersion="7"/> 

或者你要改變評價欄填充。

+0

我已經有了min = 7和target = 7。我嘗試了填充,但是這影響了整個酒吧,把它推向側面,並將最後一顆星從邊緣放下。有趣的是,它不會移動綠色部分(即填充現在看起來遠不及半分),所以現在看起來更糟。我想知道爲什麼......無論哪種方式,這是一種只能在一部手機上工作的解決方案,因爲分辨率和dpis不同。尤其是當它決定使用不同大小的恆星時。 – AlbeyAmakiir