13
Có thể thay đổi hộp thoại tiến trình của ProgressBar không. Nếu có, thì làm thế nào tôi có thể làm điều đó?Thay đổi kiểu của ProgressDialog
Có thể thay đổi hộp thoại tiến trình của ProgressBar không. Nếu có, thì làm thế nào tôi có thể làm điều đó?Thay đổi kiểu của ProgressDialog
Bạn có thể tạo kiểu tiến bộ của bạn hộp thoại theo cách này: tạo một file drawable với hình dạng chiếc nhẫn của bạn (circular_progress_dialog.xml)
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="270"
android:toDegrees="270">
<shape
android:innerRadiusRatio="2.5"
android:shape="ring"
android:thickness="2dp"
android:useLevel="true"><!-- this line fixes the issue for lollipop api 21 -->
<gradient
android:angle="0"
android:endColor="@color/main_background"
android:startColor="@color/main_orange"
android:type="sweep"
android:useLevel="false" />
</shape>
</rotate>
một phong cách thanh tiến trình của bạn
<style name="ProgressBar" parent="@android:style/Widget.ProgressBar">
<item name="android:layout_centerHorizontal">true</item>
<item name="android:layout_centerVertical">true</item>
<item name="android:visibility">gone</item>
<item name="android:background">@color/transparency_pleca</item>
<item name="android:indeterminateDrawable">@drawable/circular_progress_dialog</item>
</style>
Thông báo của bạn " android: indeterminateDrawable "property
Yout có thể tạo một phiên bản ProgressDialog
và thêm phong cách của bạn với
// create progressDialog
final ProgressDialog myProgressDialog = new ProgressDialog(MyActivity.this);
myProgressDialog.setProgressStyle(R.style.ProgressBar)
myProgressDialog.show();
loại kiểu nào bạn muốn .... ??? –
Khá dễ dàng để làm điều này và mã có thể được tìm thấy tại –
akkilis
Cảm ơn bạn đã trả lời nhanh chóng, tôi chỉ muốn thay đổi ProgressBar mặc định hoạt hình với hoạt ảnh tùy chỉnh của tôi. – Aram