接受 1
- 1.5
- 2
- 2.5
- 3
之类的值 - 3.5
- 4
- 4.5
- 5
表示:
代码 ::
<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" />
接受 1-2-3-4-5
等值
代表::
<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);
}
});
希望我很清楚