开发者

How to implement a imagebrush size in android

开发者 https://www.devze.com 2023-03-05 03:28 出处:网络
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 in

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.

-Pratima


What'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);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号