在我的应用程序中,我有缩放和进度条,如下图所示

对于进度条和标记,我有单独的图像。我需要的是如何使标记可以移动到android的进度栏上。请帮帮我。
我的布局xml是:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout android:layout_height="wrap_content" android:background="@drawable/scale_bg"
android:layout_marginLeft="10dp" android:layout_marginRight="10dp"
android:layout_width="fill_parent" android:id="@+id/relativeLayout1">
</RelativeLayout>
<FrameLayout android:layout_height="wrap_content" android:layout_marginTop="20dp"
android:layout_marginLeft="10dp" android:layout_marginRight="10dp"
android:layout_width="fill_parent" android:id="@+id/relativeLayout2">
<ImageButton android:layout_width="wrap_content"
android:id="@+id/imageButton1" android:layout_height="wrap_content"
android:background="@drawable/slider_bg" android:layout_alignParentLeft="true">
</ImageButton>
<ImageButton android:layout_width="wrap_content" android:clickable="true"
android:id="@+id/imageButton1" android:layout_height="wrap_content"
android:background="@drawable/slider_arrow" android:layout_alignParentLeft="true">
</ImageButton>
</FrameLayout>
</LinearLayout>更新的xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout android:layout_height="wrap_content" android:background="@drawable/scale_bg"
android:layout_marginLeft="10dp" android:layout_marginRight="10dp"
android:layout_width="fill_parent" android:id="@+id/relativeLayout1">
</RelativeLayout>
<RelativeLayout android:layout_height="wrap_content" android:layout_marginTop="20dp"
android:layout_marginLeft="10dp" android:layout_marginRight="10dp"
android:layout_width="fill_parent" android:id="@+id/relativeLayout2">
<SeekBar android:layout_height="wrap_content" android:id="@+id/seekBar1"
android:layout_width="match_parent" android:thumb="@drawable/slider_arrow"
android:progressDrawable="@drawable/slider_bg">
</SeekBar>
</RelativeLayout>
</LinearLayout>slider_bg和slider_arrow是png图像。
发布于 2011-10-10 14:12:17
这很简单,我建议您查看以下博客文章,这篇文章很好地描述了如何做到这一点:http://www.mokasocial.com/2011/02/create-a-custom-styled-ui-slider-seekbar-in-android/
发布于 2011-10-10 14:14:16
试一试
<SeekBar android:layout_height="wrap_content" android:id="@+id/seekBar1" android:layout_width="match_parent" android:thumb="@drawable/slider_arrow" android:progressDrawable="@drawable/slider_bg"></SeekBar>发布于 2011-10-10 14:16:22
它实际上是SeekBar,与Windows控件上的Slider相当。您需要自定义背景,颜色和索引。
https://stackoverflow.com/questions/7713975
复制相似问题