English 中文(简体)
进步 整个寻求者的可提取填表 律师
原标题:setProgressDrawable fills the entire seekBar

正如我在标题中所说的那样,当我使用一套可执行的方案时,它填补了整个寻求的Bar:如果进展为34%,进展为100%,但umb显示正确的比例为34%。 我没有说明问题是什么。

   done.setProgressDrawable(getResources().getDrawable(R.drawable.seekbar_progress));
   done.setThumb(getResources().getDrawable(R.drawable.seekbar_thumb));

争取禁运——进步。

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke android:width="15dp"    android:color="#52a8ec"/>

seekbar_thumb.xml

    <shape xmlns:android="http://schemas.android.com/apk/res/android"
 android:shape="rectangle">
<gradient android:startColor="#ffffffff" android:endColor="#ff585858" android:angle="270"/>
<size android:height="17dp" android:width="5dp"/>
</shape>

任何想法?

事先感谢你!

问题回答

试图将填表放在像样的左侧。

<clip>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke android:width="15dp"    android:color="#52a8ec"/>
</clip>

我面临同样的问题,以下法典也解决了这一问题。

如果你们使用该法典来改变你可以理解的话,那么(如果是你想要做的事的话):

int currentProgress = p.getProgress();
p.setProgress(0);
Rect bounds = p.getProgressDrawable().getBounds();
p.setProgressDrawable(getResources().getDrawable(R.drawable.progress_drawable_orange));
p.getProgressDrawable().setBounds(bounds);
p.setProgress(currentProgress);

and do not forget to add the following check in your onProgressChanged method:

@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    if(!fromUser)
        return;
    // ... THE REST OF YOUR CODE
}

rel=“nofollow noreferer”>example

I ended in the same situation as you did and managed to resolve the problem by implementing progress with layer-list XML file. See my answer here.

您可以在您的排版Xml中标出<条码>progressTint的现场,以改变进展的颜色,同时又不影响寻求巴尔的全部背景。

<SeekBar
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:progressTint="@color/seek_bar_progress"/>

还有<代码>thumbTint和progressBackgroundTint





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签