首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在android中进行如下设计和代码

如何在android中进行如下设计和代码
EN

Stack Overflow用户
提问于 2011-10-10 14:06:12
回答 3查看 645关注 0票数 0

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

对于进度条和标记,我有单独的图像。我需要的是如何使标记可以移动到android的进度栏上。请帮帮我。

我的布局xml是:

代码语言:javascript
运行
复制
<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:

代码语言:javascript
运行
复制
<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图像。

EN

Stack Overflow用户

回答已采纳

发布于 2011-10-10 14:12:17

这很简单,我建议您查看以下博客文章,这篇文章很好地描述了如何做到这一点:http://www.mokasocial.com/2011/02/create-a-custom-styled-ui-slider-seekbar-in-android/

票数 1
EN
查看全部 3 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7713975

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档