在我的项目中,我想制作一个类似于以下内容的水平进度条。
我尝试了很多图书馆,但没有一个图书馆有这个功能。有没有办法做到这一点?
这是我的代码:
dialog = new ProgressDialog(Context.this);
dialog.setIndeterminate(true);
dialog.setMessage("Some Text");
dialog.show();
答案 0 :(得分:1)
您应该使用seekBar而不是progressDialog。你可以添加android:thumb icon。
<SeekBar
android:id="@+id/seekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:thumb="@drawable/icon"
android:max="10"
android:progress="5"
android:progressDrawable="@drawable/custom_seekbar" />
定制seekbar.xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/progress">
<clip>
<shape android:shape="rectangle">
<size
android:width="12dp"
android:height="12dp" />
<corners android:radius="15dp" />
<solid android:color="#4fc3f7" />
<gradient
android:angle="270"
android:centerColor="#4fc3f7"
android:endColor="#4fc3f7"
android:startColor="#4fc3f7" />
</shape>
</clip>
</item>
</layer-list>