I am new to android development. I have started implementing paint related app. In that i wanted the user to select the brush size which is shown on a bar. I mean on pressing '+' button it should increase the brush size and move slightly on the bar and vice versa on pressing '-' button. Is there any API which I can use like the one in 开发者_运维技巧iPhone(I heard about spinner API)? I have not found any such API on the net.
Any help is greatly appreciated.
Thanks in advance.
-PratimaWhat's about SeekBar? For example
RelativeLayout.LayoutParams params3 =
new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
params3.addRule(RelativeLayout.ABOVE, RemindButton.getId());
WidthBar = new SeekBar(this);
WidthBar.setMax(70);
WidthBar.setProgress(15);
WidthBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
if (fromUser)
mPaint.setStrokeWidth(progress); //Change StrokeWidth
}
});
LL.addView(WidthBar,params3);
精彩评论