自定义进度对话框不工作 [英] Custom progress dialog not working

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

问题描述

我发现这个漂亮的自定义进度对话框: https://github.com/d-max /段位对话框

和作为内如下片段的onClick 功能(如连接到远程设备上的按钮preSS制造)使用它我:

  AlertDialog对话框=新SpotsDialog(parentActivity,R.style.custom_dialog);
    dialog.show();
    //蓝牙耗时code。
    dialog.dismiss();
    parentActivity.loadFragment(DrawerActivity.Fragments.FILE_BROWSER,捆绑,真实);

我已经定义了以下 styles.xml

 <样式名称=CUSTOM_DIALOG父=机器人:Theme.DeviceDefault.Dialog>
    <项目名称=DialogTitleAppearance> @android:风格/ TextAppearance.Medium< /项目>
    <项目名称=DialogTitleText>更新...< /项目>
    <项目名称=DialogSpotColor> @android:彩色/ holo_orange_dark< /项目>
    <项目名称=DialogSpotCount> 4℃; /项目>
< /风格>

更新的依赖关系按GitHub的页面上作出批示如下:

  {相关性
    编译com.github.d-MAX:段位对话框:0.4@aar
}

我不知道我错过了什么。任何帮助AP preciated。

编辑:从添加的gradle相关元件:

安卓{
    compileSdkVersion 23
    buildToolsVersion21.1.2

  defaultConfig {
    的applicationIDedu.unm.twin_cities.graphit
    15的minSdkVersion
    targetSdkVersion 16
    版本code 1
    的versionName1.0
}


解决方案

  1. 您是API级别必须是高于15。

  2. 在pre-棒棒糖设备DialogSpotColor项目将无法正常工作。作为变通方法只覆盖你的资源的颜色。你的最高等级API是16,棒棒糖其21及更高版本。

尝试从你的风格扔掉DialogSpotColor项目。

 <样式名称=CUSTOM_DIALOG父=机器人:Theme.DeviceDefault.Dialog>
<项目名称=DialogTitleAppearance> @android:风格/ TextAppearance.Medium< /项目>
<项目名称=DialogTitleText>更新...< /项目>
<项目名称=DialogSpotCount> 4℃; /项目>

和添加此行到您的colors.xml:

 <颜色名称=spots_dialog_color> @android:彩色/ holo_red_light< /彩色>

I found this nice custom progress dialog box: https://github.com/d-max/spots-dialog

and am using it as follows inside onClick function of the fragment (as connection to remote device is made on a button press):

    AlertDialog dialog = new SpotsDialog(parentActivity, R.style.custom_dialog);
    dialog.show();
    //bluetooth time consuming code.
    dialog.dismiss();
    parentActivity.loadFragment(DrawerActivity.Fragments.FILE_BROWSER, bundle, true);

I have defined the following in styles.xml:

<style name="custom_dialog" parent="android:Theme.DeviceDefault.Dialog">
    <item name="DialogTitleAppearance">@android:style/TextAppearance.Medium</item>
    <item name="DialogTitleText">Updating…</item>
    <item name="DialogSpotColor">@android:color/holo_orange_dark</item>
    <item name="DialogSpotCount">4</item>
</style>

Updated the dependencies as follows as per instructions given on the github page:

dependencies {
    compile 'com.github.d-max:spots-dialog:0.4@aar'
}

I am not sure what I am missing. Any help appreciated.

EDIT: Adding relevant component from gradle:

android { compileSdkVersion 23 buildToolsVersion "21.1.2"

defaultConfig {
    applicationId "edu.unm.twin_cities.graphit"
    minSdkVersion 15
    targetSdkVersion 16
    versionCode 1
    versionName "1.0"
}

解决方案

  1. You're API level must be a higher then 15.
  2. On the pre-lollipop devices DialogSpotColor item won't work. As workaround just override color in your resources. Your max level API is 16, lollipop its 21 and higher.

Try throw away the DialogSpotColor item from your style.

<style name="custom_dialog" parent="android:Theme.DeviceDefault.Dialog">
<item name="DialogTitleAppearance">@android:style/TextAppearance.Medium</item>
<item name="DialogTitleText">Updating…</item>
<item name="DialogSpotCount">4</item>

And add this line into your colors.xml:

<color name="spots_dialog_color">@android:color/holo_red_light</color>

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

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