Android的搜索栏[进度]的风格 - 如何设置自定义背景绘制 [英] Android SeekBar [ProgressBar] style - how to set custom background drawable

查看:264
本文介绍了Android的搜索栏[进度]的风格 - 如何设置自定义背景绘制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要让搜索栏这样的: http://img687.imageshack.us/ img687 / 2371 / volumec.png
关键是,我已经已经找到定制seekbars在这里的http://groups.google.com/group/android-developers/browse_thread/thread/be3fed0b4f766cc?pli=1
但问题是,我需要那些** **差距在我的绘制和我不间
T知道如何管理。
你会这么好心一些你,我心底AP preciate非常喜欢。
在此先感谢,祝一切顺利!

I want to make seekbar like this: http://img687.imageshack.us/img687/2371/volumec.png The thing is, that Ive already found customizing seekbars over here http://groups.google.com/group/android-developers/browse_thread/thread/be3fed0b4f766cc?pli=1 but the problem is, that I need **those gaps** between in my drawable and I dont know how to manage that. Would you be so kind some of you, I`ll appreciate it very much. Thanks in advance, wishing all the best!

这是应用到搜索栏我的资源style.xml文件:

this is my resources style.xml file that is applied to seekbar:

<item name="android:indeterminateOnly">false</item>
<item name="android:progressDrawable">@drawable/seekbarcolors</item>
<item name="android:indeterminateDrawable">@drawable/seekbarcolors</item>
<item name="android:minHeight">20dip</item>
<item name="android:maxHeight">20dip</item>
<item name="android:thumbOffset">8px</item>
<item name="android:focusable">true</item>

和这里是我的@绘制/ seekbarcolors:

and here is my @drawable/seekbarcolors:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
    <shape>
        <solid android:color="#ff0000" />
    </shape>
</item>
<item android:id="@android:id/secondaryProgress">
    <clip>
        <shape>
            <solid android:color="#00ff00" />
        </shape>
    </clip>
</item>
<item android:id="@android:id/progress">
    <clip>
        <shape>
            <solid android:color="#0000ff" />
        </shape>
    </clip>
</item>

推荐答案

一个搜索栏是pretty强大的部件。 DDO你希望用户能够在这里求的音量?这不是做以示与差距的进展。

A Seekbar is a pretty powerful widget. Ddo you want the user to be able to "seek" the volume here? It's not made to show progress with gaps.

您需要什么在这里(如果你不需要抢,寻求体积)是很多简单。创建一个单一的ImageView为卷在你的样品图片的权利。在你看进度的AsyncTask,把code在onProgressUpdate()来改变整个10图像所显示的图像 - 每次一样,最后却多一个酒吧 - 是进步突破各占10%。你可以写code把一个单一的形象次正确定位跨越空间,但是这是很难和你买一点。

What you need here (if you don't need to grab and seek the volume) is lots simpler. Create a single ImageView to the right of "Volume" in your sample pic. In your progress-watching AsyncTask, put code in onProgressUpdate() to change the shown image across 10 images - each the same as the last but with one more bar - as progress breaks each 10%. You can write code to put a single image times properly positioned across a space, but that is harder and buys you little.

这篇关于Android的搜索栏[进度]的风格 - 如何设置自定义背景绘制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆