【问题标题】:SeeKBar in ListView thumb offset not working as expectedListView 拇指偏移中的 SeeKBar 未按预期工作
【发布时间】:2017-01-03 05:57:51
【问题描述】:

我正在修改 openHAB android 应用程序的 UI。我试图实现的示例图像如下图所示。

请注意进度条的宽度和拇指的位置。拇指只会向上移动到进度条的边缘。为了完成这项工作,我在 SeekBar 中使用了 setThubOffset() 方法,该方法具有负偏移值,并且当拇指移动时偏移起作用。

当进度值更改时,进度值将发送到服务器,并随着来自服务器的响应 ListView 使用 notifyDataSetChanged() 调用更新,SeekBar 的进度将被修改,这次拇指的位置发生变化并且它超出了进度条的范围。不知道为什么即使偏移量为负,拇指也会向外移动。

源码是这样的

public View getView(int position, View convertView, ViewGroup parent) {
....
sliderSeekBar.setThumbOffset(-15);
....
sliderSeekBar.setProgress(...);
....
}

谁能告诉我可能出了什么问题?

【问题讨论】:

    标签: android listview openhab


    【解决方案1】:
    sliderSeekBar.setProgress(0);     
    sliderSeekBar.setProgress(...);
    

    解决了这个问题。 got help from here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-11
      • 1970-01-01
      • 2015-12-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多