在视觉上看起来像ratingbar但是一个SeekBar

时间:2013-10-06 10:40:56

标签: android

RatingBar给出了功能::

接受 1 - 1.5 - 2 - 2.5 - 3之类的值 - 3.5 - 4 - 4.5 - 5

表示:

enter image description here

代码 ::

<RatingBar
                android:id="@+id/RATINGinitialvalueratingID"
                style="?android:attr/ratingBarStyleSmall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/RATINGseekBarID"
                android:clickable="false"
                android:focusable="false"
                android:numStars="5"
                android:rating="0" />

seekbar提供了功能::

接受 1-2-3-4-5等值

代表::

enter image description here

<SeekBar
                android:id="@+id/RATINGseekBarID"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_below="@+id/textView1"
                android:layout_marginTop="26dp"
                android:max="100" >
            </SeekBar>

搜索栏的Java代码

PRICEbar = (SeekBar)findViewById(R.id.PRICEseekBarID); // make seekbar object
        PRICEbar.setOnSeekBarChangeListener(this); 
        PRICEbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
                // TODO Auto-generated method stub

            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
                // TODO Auto-generated method stub

            }

            @Override
            public void onProgressChanged(SeekBar seekBar, int progress,
                    boolean fromUser) {
                // TODO Auto-generated method stub
                PRICEtextProgress = (TextView)findViewById(R.id.PRICEtextViewProgressID);
                PRICEtextProgress.setText("Price:: Rs "+progress);
                seekBar.setMax(100);

            }
        });

有可能吗?

如何定制设计评级栏,看起来像搜索栏。 ?

希望我很清楚

1 个答案:

答案 0 :(得分:1)

This might help you。 它会让你了解它是如何工作的。您必须放置一个包含png种设计的ratingbar文件。

相关问题