1

我很好奇为什么一旦我开始弄乱它的背景并用不同的图像(你点击移动的球)替换正常的滑块图像,搜索栏就没有顺利进行。

搜索栏看起来正是我想要的样子,但它并不平滑,它会跳跃而不是像标准搜索栏那样平滑流动。

这是3个xml文件:

seekbar_progress_bg.xml

 <?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

    <item>
        <clip>
            <shape>
                <corners android:radius="5dip" />
                <gradient
                    android:angle="270"
                    android:centerColor="#FF32a0d2"
                    android:centerY="0.1"
                    android:endColor="#FF13729e"
                    android:startColor="#FF5e8ea3" />
            </shape>
        </clip>
    </item>
</layer-list>

seekbar_progress.xml

    <?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

    <item android:id="@android:id/background">
        <shape>
            <corners android:radius="5dip" />
            <gradient
                android:angle="270"
                android:centerColor="#FFFFFF"
                android:centerY="0.75"
                android:endColor="#FFFFFF"
                android:startColor="#FFFFFF" />
        </shape>
    </item>
    <item android:id="@android:id/secondaryProgress">
        <clip>
            <shape>
                <gradient
                    android:angle="270"
                    android:centerColor="#80127fb1"
                    android:centerY="0.75"
                    android:endColor="#a004638f"
                    android:startColor="#80028ac8" />
            </shape>
        </clip>
    </item>
    <item
        android:id="@android:id/progress"
        android:drawable="@drawable/seekbar_progress_bg"/>

</layer-list>

主要的.xml

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0.64" >

        <SeekBar
            android:id="@+id/frequency_slider"
            android:layout_width="919dp"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="136dp"
            android:max="20"
            android:progress="0"
            android:progressDrawable="@drawable/seekbar_progress"
            android:secondaryProgress="0"
            android:thumb="@drawable/triton_slider_handle" />

    </RelativeLayout>

</LinearLayout>
4

0 回答 0