Seekbar的线路因主题更改而中断,如何解决?

时间:2019-05-24 06:58:47

标签: android android-appcompat android-seekbar

我的seekbar类扩展了SeekBar,bar看上去“不错”,但是当我将主题添加到bar为(AppCompat主题)的活动中时,bar仍然照常工作,但是外观有问题。 我的酒吧与此类似:https://images.zoftino.com/development/android-dev/ui/android-seekbar-materil-style-custom-color.png

问题是进度线没有连接到进度图,它在进度图的左右两侧被打断了。 我将尝试一些绘图...这是它的外观(以前确实有过): _________.________

这是现在的样子(添加主题之后): ________。 _______

线没有用拇指连接。我看到当我按下拇指时,它会动画,在拇指周围绘制白色圆圈,并且该白色圆圈填充进度拇指周围的空白区域,因此我猜测是因为该行而中断了。

有人可以确认这是原因吗,并且在可能的情况下以任何方式提供解决方案?

主题:

>>> import pandas as pd
>>> a = pd.read_csv(r'L:\Stackoverflow\my_txt.txt', delim_whitespace=True, header=None, names=['A', 'B'])

>>> a.plot(x='A', y='B')    # You can e.g. plot the second column vs. the first one

样式:

<activity
        android:name=".activity.MainActivity"
        android:configChanges="orientation|screenSize|keyboardHidden"
        android:launchMode="singleTask"
        android:screenOrientation="sensorLandscape"
        android:theme="@style/Theme.MyCompatTheme"/>

布局中的搜索栏:

<style name="Theme.MyCompatTheme" parent="@style/Theme.AppCompat">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

Progress_thumb.xml可绘制:

<co.***.***.***.ProgressIndicator
                android:id="@+id/pl_current_programme_progress"
                style="@android:style/Widget.Holo.SeekBar"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_weight="1"
                android:maxHeight="6dp"
                android:minHeight="6dp"
                android:paddingLeft="10dp"
                android:paddingRight="10dp"
                android:thumb="@drawable/progress_thumb"/>

ProgressIndicator.class:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
    <shape android:shape="oval">
        <solid android:color="#00ffffff" />
        <size android:width="35dp" android:height="35dp" />
    </shape>
</item>
<item android:top="10dp" android:left="10dp" android:right="10dp" android:bottom="10dp">
    <shape android:shape="oval">

        <solid android:color="@color/progress_thumb_color" />

        <size android:width="15dp" android:height="15dp" />
    </shape>
</item>
</layer-list>

1 个答案:

答案 0 :(得分:0)

在将主题更改为AppCompat后设法修复了搜索栏。只需添加:

android:splitTrack="false"

在布局内部的搜寻栏元素中,搜寻栏正常,拇指周围没有空白。