如何在 Android 中自定义进度对话框 [英] How to customize the Progress Dialog in Android

查看:60
本文介绍了如何在 Android 中自定义进度对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在实施进度对话框自定义.在这里,我添加了样式和颜色.

I am implementing the progress dialog customization. In this I am adding the styles and colors.

 <style name="ProThemeOrange" parent="@android:style/Theme.Dialog">
    <item name="android:alertDialogStyle">@style/CustomAlertDialogStyle</item>
    <item name="android:textColorPrimary">#e6e6e6</item>
    </style>

    <style name="CustomAlertDialogStyle">

  <item name="android:bottomDark">@color/yellow</item>
    <item name="android:bottomMedium">@color/yellow</item>
    <item name="android:centerBright">@color/yellow</item>
    <item name="android:centerDark">@color/yellow</item>
    <item name="android:centerMedium">@color/yellow</item>
   <item name="android:fullBright">@color/yellow</item>
    <item name="android:fullDark">@color/yellow</item>
    <item name="android:topBright">@color/yellow</item>
    <item name="android:topDark">@color/yellow</item> 
</style>

我正在将样式添加到 ProgressDialog.

And I am adding the style to ProgressDialog.

ProgressDialog pd = new ProgressDialog(this, R.style.ProThemeOrange);

我获得了背景颜色,但在进度对话框的顶部,我获得了黑色.

I am getting the background color but on the top of progress dialog I'm getting black Color.

我参考了这个链接

我需要整个背景颜色为深红色.

I need total background color as crimsonred.

推荐答案

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >

<RelativeLayout
    android:layout_width="135dp"
    android:layout_height="56dp"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="146dp"
    android:background="#e64b3c"
    android:orientation="horizontal" >

    <ProgressBar
        android:id="@+id/progressBar1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_toRightOf="@+id/progressBar1"
        android:text="Please wait..." />

</RelativeLayout>

这篇关于如何在 Android 中自定义进度对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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