我创建了一个自定义的拖动条滑块,它在Android Studio预览中看起来非常好,但是在我的设备上运行应用程序时,它却显示错误!
应该长成这样: 但实际上在我的设备上看起来像这样: 以下是我的seekbar_thumb.xml代码:
我的SeekBar代码
应该长成这样: 但实际上在我的设备上看起来像这样: 以下是我的seekbar_thumb.xml代码:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:height="35dp" android:width="35dp" >
<shape android:shape="oval">
<solid android:color="#fff" />
</shape>
</item>
<item android:gravity="center" android:height="15dp" android:width="15dp">
<shape android:shape="oval">
<solid android:color="@color/colorPrimary" />
</shape>
</item>
我的SeekBar代码
<SeekBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/seekBar"
android:max="100"
android:progress="50"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_centerInParent="true"
android:thumb="@drawable/seekbar_thumb"
android:progressDrawable="@drawable/progress_bar_background"
android:layout_marginBottom="@dimen/seekbar_margin_bottom"
android:layout_marginRight="@dimen/seekbar_margin_rt"
android:layout_marginLeft="@dimen/seekbar_margin_lt"
android:thumbOffset="0dp"/>