【问题标题】:Positionning the spinning wheel in a custom progress dialog在自定义进度对话框中定位纺车
【发布时间】:2011-10-12 10:16:20
【问题描述】:

我正在使用给定here 的自定义进度对话框,其样式如下所示。旋转轮居中,我找不到如何为其设置自定义位置。

有人可以帮忙吗?

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="NewDialog">
        <item name="android:windowFrame">@null</item>
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:windowIsFloating">true</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowTitleStyle">@null</item>
        <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
        <item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
        <item name="android:background">@android:color/transparent</item>
    </style>    
</resources>

【问题讨论】:

    标签: android progressdialog


    【解决方案1】:

    在您的布局中使用 ProgressBar。您可以将其放置在屏幕上的任何位置。

    <ProgressBar android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    style="?android:attr/progressBarStyle"              
                    android:id="@+id/showProgress"/>
    

    【讨论】:

    • 我需要一个默认大小的旋转轮,透明(比如#50000000)背景填充父级。如果我在 ProgessBar 中将 android:layout_width 和 android:layout_height 设置为 fill_parent,我会得到一个巨大的旋转轮。根据我在问题中提供的链接,它只能通过自定义对话框来完成。唯一的问题是轮子居中,我想设置一个自定义位置。您有替代解决方案吗?
    • 你可以看到这个链接。我已经在我的博客中添加了代码。 sujitdroid.blogspot.com/2011/10/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-18
    • 1970-01-01
    • 2012-01-14
    • 2017-11-02
    • 1970-01-01
    相关资源
    最近更新 更多