1
我看了看其他的聯繫,並試圖他們說什麼,似乎沒有什麼工作,但是當我添加搜索條拇指最終得到切斷這樣的:默認搜索欄拇指切斷
這是我有什麼:
public void addSeekBar(int topMargin, int leftMargin, int width, int height, final int myWidth) {
View st = new SeekBar(getBaseContext());
SeekBar slider = new SeekBar(st.getContext());
slider.setMax(9);
slider.setProgress(5);
slider.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
public void onStopTrackingTouch(SeekBar seekBar) {
}
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
drawStars((float) ((progress + 1)/2.0), myWidth);
}
});
LayoutParams paramsText = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
paramsText.leftMargin = leftMargin;
paramsText.topMargin = topMargin;
paramsText.width = width;
paramsText.height = height;
//Other threads said to set the left and right margin to half the width
//of the thumb and set the thumb offset to 8, I did this here but it didn't
//seem to work
slider.setPadding(16, 0, 16, 0);
slider.setThumbOffset(8);
container.addView(slider, paramsText);
}
我試圖左右邊距設置爲拇指寬度的一半像其他人建議,它仍然看起來像上面的圖片,我真的不知道還有什麼做,任何幫助將不勝感激。謝謝!