android - 搜索栏进度不会一直被绘制

发布于 2024-11-08 05:42:55 字数 1525 浏览 1 评论 0原文

有谁知道我为什么会收到这个(见图)?

以下是我的设置方法:

    this._seekBar.setProgressDrawable(_context.getResources().getDrawable(R.drawable.common_controls_player_progressbar_bg_expanded));
                this._seekBar.setThumb(_context.getResources().getDrawable(R.drawable.ringtone_scrub));
this._seekBar.setThumbOffset(0);
this._seekBar.setMax(1000);
this._seekBar.setMinimumHeight(6);

Seekbar 本身:

<SeekBar android:id="@+id/seekbar_ctrl" android:layout_width="wrap_content" android:layout_height="wrap_content" android:maxHeight="6dp"/>

展开视图 xml

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@android:id/background">
        <shape>
         <solid android:color="@color/player_progressbar_gray"/>
        </shape>
    </item>
    <item android:id="@android:id/secondaryProgress">
        <clip>
            <shape>
             <solid android:color="@color/player_progressbar_gray"/>
            </shape>
        </clip>
    </item>
    <item android:id="@android:id/progress">
        <clip>
            <shape>
                 <solid android:color="@color/player_progressbar_green"/>
            </shape>
        </clip>
    </item>
</layer-list> 

它确实发生在展开视图和折叠视图中。我缺少什么?

预先感谢您在此处输入图像描述

does anybody know why I am getting this (see photo)?

Here is how I set it:

    this._seekBar.setProgressDrawable(_context.getResources().getDrawable(R.drawable.common_controls_player_progressbar_bg_expanded));
                this._seekBar.setThumb(_context.getResources().getDrawable(R.drawable.ringtone_scrub));
this._seekBar.setThumbOffset(0);
this._seekBar.setMax(1000);
this._seekBar.setMinimumHeight(6);

Seekbar itself:

<SeekBar android:id="@+id/seekbar_ctrl" android:layout_width="wrap_content" android:layout_height="wrap_content" android:maxHeight="6dp"/>

Expanded view xml

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@android:id/background">
        <shape>
         <solid android:color="@color/player_progressbar_gray"/>
        </shape>
    </item>
    <item android:id="@android:id/secondaryProgress">
        <clip>
            <shape>
             <solid android:color="@color/player_progressbar_gray"/>
            </shape>
        </clip>
    </item>
    <item android:id="@android:id/progress">
        <clip>
            <shape>
                 <solid android:color="@color/player_progressbar_green"/>
            </shape>
        </clip>
    </item>
</layer-list> 

It does happen in both expanded and collapsed view. What am I missing?

Thank you in advanceenter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅唱ヾ落雨殇 2024-11-15 05:42:55

这是由于启动了我正在切换的两个控件。 1. 展开模式 2. 折叠模式。由于我一次只设置一个控件,因此在切换之间进度状态丢失了。所以我解决这个问题的方法是:我在控件支架上放置了 2 个进度条控件,并同时设置它们。一张仍然隐藏,另一张则显示出来。在切换事件期间,我切换了可见性。这解决了问题。使用相同控件时我们遇到的第二个问题是点击进度在设置之前会来回闪烁。原来是手机操作系统的问题以及播放器本身的问题。我们获得了新的操作系统版本并解决了该问题。

this was due to the launch of two controls that I was toggling. 1. expanded mode 2. collapsed. State of the progress was lost between toggles since I was only setting one control at a time. So what I did to fix this was: I placed 2 progress bar controls on the control holder and was setting them both at the same time. One remained hidden the other one was shown. During toggle event I switched the visability. That solved the issue. The second issue we had with same control was the progress on tap would flicker back and forth before being set. It turned out to be the issue with the OS of the phone and related to the player itself. We got a new OS build release and that fixed the issue.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文