您已经在Android中开发了自定义搜索栏,我希望搜索栏的进度条与搜索栏拇指的高度相同。我怎么能实现它有没有人知道我们如何做到这一点。
red_progress.xml
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@android:id/background"
android:drawable="@drawable/slider_fill_default_patch"
/>
<item android:id="@android:id/secondaryProgress">
<scale
android:drawable="@drawable/slider_fill_patch"
android:scaleWidth="100%"
/>
</item>
<item android:id="@android:id/progress">
<scale
android:drawable="@drawable/slider_fill_patch"
android:scaleWidth="100%"/>
</item>
red_scrubber_control.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/alert_thumb_slider" android:state_enabled="false"/>
<item android:drawable="@drawable/alert_thumb_slider" android:state_pressed="true"/>
<item android:drawable="@drawable/alert_thumb_slider" android:state_selected="true"/>
<item android:drawable="@drawable/alert_thumb_slider"/>
布局文件
<SeekBar
android:id="@+id/seek2"
android:layout_below="@+id/seek1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:progressDrawable="@drawable/red_progress"
android:indeterminate="false"
android:thumbOffset="0dp"
android:visibility="visible"
android:indeterminateOnly="false"
android:thumb="@drawable/red_scrubber_control" />