最近接触安卓seekbar控件的自适应,可是使其与屏幕参数关联怎么都打不到自己想要的效果。直接对整个seekbar控件实现自适应对应的滑动图片缺没有发生变化,这样给出的效果是图片不变或者图片不能完全显示。为了解决这个滑动图片的自适应问题,做法如下
SeekBar seekBar1=(SeekBar) findViewById(R.id.seekBar1);
BitmapDrawable drawableTop1 = (BitmapDrawable)getResources().getDrawable(R.drawable.bg4);
Bitmap rotatBitmap=drawableTop1.getBitmap().createScaledBitmap(drawableTop1.getBitmap(),(int)( comPM.WIDTH_layout_leds_frame/32 ), (int)comPM.WIDTH_layout_leds_frame/32, true);
Drawable drawable = new BitmapDrawable(rotatBitmap);
seekBar1.setThumb(drawable);