【问题标题】:Custom seek bar with thumb and progressDrawable带有拇指和progressDrawable的自定义搜索栏
【发布时间】:2014-11-20 11:43:15
【问题描述】:

我尝试自定义搜索栏,如下所示

But problem is that 
-thumb image not set with text 
-thumb position can not set above seekbar.
-android:progressDrawable should not repeat as below  

我的代码如下:

         <SeekBar
            android:id="@+id/volume_bar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:max="100"
            android:progress="20"                
            android:progressDrawable="@drawable/bar"
            android:secondaryProgress="0"                
            android:thumb="@drawable/greenarrow" />

【问题讨论】:

  • 对绿色箭头使用另一个视图,并通过使用不可见的拇指根据搜索栏更改其边距来移动它
  • 感谢回答。你能解释一下如何用拇指移动自定义视图吗?

标签: android seekbar


【解决方案1】:

我已经尝试过这样做,但我遇到了响应时间问题。必须移动边距需要大量的处理能力和时间。它接近 400-500 毫秒。所以我不得不删除它。

但是,以下是我采取的步骤: 首先,我建议创建一个框架布局来容纳 SeekBar 和 TextView。然后,根据进度条的百分比,可以设置 TextViews 布局属性的边距。 这有意义吗?

如果你想要特定的代码,我可以给你,但谷歌也做得很好。 :)

选项 B: Android seekbar with custom thumb having dynamic text inside it

【讨论】:

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