1

カスタムの RatingBar スタイルを設定しました

style.xml 内では、これが私のコードです:

<item name="android:ratingBarStyle">@style/RatingBarStyle</item>
<style name="RatingBarStyle" parent="android:Widget.RatingBar">
    <item name="android:progressDrawable">@drawable/ratingbar</item>
    <item name="android:minHeight">13dip</item>
    <item name="android:maxHeight">13dip</item>
</style>

ダイアログ(Xml)のカスタムレイアウトを作成しました[相対レイアウト内にあります]:

<RatingBar
    android:id="@+id/custom_dialog_vota_ratingbar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/custom_dialog_vota_label_ratingbar"
    android:layout_below="@+id/custom_dialog_vota_label_ratingbar"
    android:layout_marginTop="2dp"
    android:max="5"
    android:numStars="5"
    android:stepSize="0.5" />

私のクラスでは、次のコードがあります。

public void onClick(View view) {
            final Dialog dialog = new Dialog(mContext);
            dialog.setContentView(R.layout.custom_dialog_vota);
            dialog.setTitle("Vota");
            String t = ((TextView)dialog.findViewById(R.id.custom_dialog_vota_label_ratingbar)).getText().toString();
            ((TextView)dialog.findViewById(R.id.custom_dialog_vota_label_ratingbar)).setText(t + nome_book);
            dialog.show();
        }

現在、RatingBar はどこでも正常に動作しますが、このダイアログでは動作せず、理由がわかりません..
助けてください

編集エミュレータで動作しない理由はわかりませんが、IDE のプレビューでは完全に動作します!

EDIT2これが私の結果です:
私のカスタムRatingBarがListviewまたは次のような他のアクティビティでどのように機能するかを確認できます: できます

しかし、私のダイアログではそうではなく、すでに私のデバイスにアップロードしようとしましたが、まだ何も.. うまくいきません

「ぼかし」で申し訳ありませんが、(オフィスで働いている)私のwipアプリを表示できません..

4

1 に答える 1