由于某种原因 - 运行我的应用程序时 - 处理发生时(服务器请求) - 我看到我的自定义微调器(确定)和一个条...我无法弄清楚为什么.. 它不会发生在所有设备中......
这是我的代码:
public ServerRequests(Context context) {
progressDialog = new Dialog(context);
progressDialog.setCancelable(false);
progressDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
progressDialog.setContentView(R.layout.progress_spinner);
}
progress_spinner.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
<ProgressBar
android:id="@+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:indeterminateDrawable="@drawable/progress"/>
</RelativeLayout>
progress.xml
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:duration="5"
android:toDegrees="1080">
<shape
android:shape="ring"
android:innerRadiusRatio="3"
android:thicknessRatio="8"
android:useLevel="false">
<size
android:height="48dip"
android:width="48dip" />
<gradient
android:endColor="#cdcd00"
android:startColor="@android:color/transparent"
android:type="sweep"
android:angle="0"
android:useLevel="false" />
</shape>
</rotate>
答案 0 :(得分:2)
此栏实际上是对话框标题栏分隔符。它在棒棒糖或以后不存在,但它确实存在于ics to kk
所以你需要的是将它设置为透明,如下所示:
progressDialog = new Dialog(context);
progressDialog.setCancelable(false);
progressDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
progressDialog.setContentView(R.layout.progress_spinner);
if (android.os.Build.VERSION.SDK_INT <= 19 && android.os.Build.VERSION.SDK_INT >= 14) {
int dividerId = progressDialog.getContext().getResources().getIdentifier("android:id/titleDivider", null, null);
View divider = progressDialog.findViewById(dividerId);
divider.setBackgroundColor(Color.TRANSPARENT);
}
了解详情:How to change alert dialog header divider color android