阅读Google提供的有限文档后,我感觉可以通过简单地创建一个新样式并将其分配给ProgressBar的样式属性来更改ProgressBar/ProgressDialog的外观(可绘制).但我不能让它正常工作.这是我到目前为止所做的:
我创建了这样的形状(mp2.xml)
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="ring"
android:innerRadiusRatio="4"
android:thicknessRatio="4"
android:useLevel="false">
<size android:width="50dip" android:height="50dip" />
<gradient android:type="sweep" android:useLevel="false" android:startColor="#300000ff" android:centerColor="#500000ff" android:endColor="#ff0000ff" />
</shape>
Run Code Online (Sandbox Code Playgroud)
然后像这样创建了一个动画(mp3.xml):
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false">
<item android:duration="70">
<rotate xmlns:android="http://schemas.android.com/apk/res/android" android:drawable="@drawable/mp2" android:pivotX="50%" android:pivotY="50%" android:fromDegrees="0" android:toDegrees="30" android:repeatCount="1" />
</item>
<item android:duration="70">
<rotate xmlns:android="http://schemas.android.com/apk/res/android" android:drawable="@drawable/mp2" android:pivotX="50%" android:pivotY="50%" android:fromDegrees="30" android:toDegrees="60" android:repeatCount="1" />
</item>
<item android:duration="70">
<rotate xmlns:android="http://schemas.android.com/apk/res/android" android:drawable="@drawable/mp2" android:pivotX="50%" android:pivotY="50%" android:fromDegrees="60" android:toDegrees="90" android:repeatCount="1" />
</item>
<item android:duration="70">
<rotate xmlns:android="http://schemas.android.com/apk/res/android" android:drawable="@drawable/mp2" android:pivotX="50%" android:pivotY="50%" android:fromDegrees="90" android:toDegrees="120" android:repeatCount="1" />
</item>
<item android:duration="70"> …Run Code Online (Sandbox Code Playgroud) 我想设置progressDialog的主题.要创建它,我使用以下代码:
progressDialog = ProgressDialog.show(this, "Please Wait", "Loading dictionary file....", true, false);
Run Code Online (Sandbox Code Playgroud)
我不能写
progressDialog = new ProgressDialog(...);
progressDialog.(do_sth_with_dialog);
progressDialog.show(...)
Run Code Online (Sandbox Code Playgroud)
因为show()方法是静态的,我得到编译器警告.有没有办法使用可用的常量,如
progressDialog.THEME_HOLO_DARK
Run Code Online (Sandbox Code Playgroud)
设置对话框主题?
我还想改变Dialog背景并使角落成圆形(我不想用progressDar里面的progressBar改变任何东西.这里有很多教程,但它们通常描述如何创建扩展progressDialog类的新类.
是否有更简单的方法来设置progressDialog的THEME和BACKGROUND颜色?
为什么我可以访问progressDialog.THEME_HOLO_DARK等常量,如果我不能使用它们?
我想要一个完全自定义的Dialog或PopupWindow,没有任何默认的Android UI控件(标题,背景,按钮等等).
这有可能吗?我花了几个小时寻找这个,但没有运气......看起来这应该很容易,但我找不到它.
最好是通过从XML中扩展View,但此时任何可行的东西都会很好.
谢谢.
我按照文档中customdialog示例中的步骤操作,但是我得到了这个例外.有任何想法吗?
04-03 18:50:28.787: VERBOSE/Bru_Press_Tab(750): Exception in Tabsjava.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.brown/com.example.brown.Bru_Press_MostRecent}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
Run Code Online (Sandbox Code Playgroud)