如何在android中设计和编码,如下所示

如何在android中设计和编码,如下所示,android,android-layout,android-image,Android,Android Layout,Android Image,在我的应用程序中,我有缩放和进度条,如下图所示 我有单独的进度条和标记图像。我需要的是如何使标记在android的进度条上移动。请帮帮我 我的布局xml是: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_p

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

我有单独的进度条和标记图像。我需要的是如何使标记在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\u bg和slider\u arrow都是png图像。

这很简单,我建议你看看下面的博客文章,这篇文章很好地描述了如何做:

试试看

    <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>


它实际上是
SeekBar
,与Windows控件上的
滑块相当。您需要自定义背景、颜色和索引器。

我在错误日志main.xml中发现以下错误:java.lang.unsupportedOperation错误。请帮助我。错误来自哪里?我的示例在这里运行良好。请在我编辑的问题中查看我更新的xml。slider_bg和slider_arrow都是png图像。我想它不是从XML文件提交的。我参考了该网站,但我得到了以下错误:无法解析文件C:\PhysicalTherapy\painscale\res\drawable\seekbar_progress.XML。请帮帮我