0
我有一個自定義加載,我顯示在我的活動之上。
這是確定的,它工作正常,但我需要在這裏做的一兩件事。(有點複雜了我。)
在這裏,我怎樣才能讓我的背景頁面(查看)滾動能夠和加載仍然會那裏。?
簡而言之...加載滾動活動。
這是我已經實施的代碼,用於顯示透明加載。
public class TransparentProgressDialog extends Dialog {
private ImageView iv;
private TextView tv;
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
public TransparentProgressDialog(Context context, int resourceIdOfImage) {
super(context, R.style.Theme_Transparent);
WindowManager.LayoutParams wlmp = getWindow().getAttributes();
wlmp.gravity = Gravity.CENTER_HORIZONTAL;
getWindow().setAttributes(wlmp);
setTitle(null);
setCancelable(false);
setOnCancelListener(null);
LinearLayout layout = new LinearLayout(context);
layout.setBackgroundDrawable((context.getResources().getDrawable(R.drawable.background_view_rounded_single)));
layout.setOrientation(LinearLayout.VERTICAL);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
iv = new ImageView(context);
iv.setImageResource(resourceIdOfImage);
tv= new TextView(context);
tv.setText("Loading...");
tv.setTextColor(Color.parseColor("#000000"));
tv.setTextSize(18f);
tv.setTypeface(null,Typeface.BOLD);
layout.addView(tv, params);
layout.addView(iv, params);
addContentView(layout, params);
}
@Override
public void show() {
super.show();
RotateAnimation anim = new RotateAnimation(0.0f, 360.0f , Animation.RELATIVE_TO_SELF, .5f, Animation.RELATIVE_TO_SELF, .5f);
anim.setInterpolator(new LinearInterpolator());
anim.setRepeatCount(Animation.INFINITE);
anim.setDuration(2000);
iv.setAnimation(anim);
iv.startAnimation(anim);
}
}
嗯,首先,加載對話由Android的設計模式氣餒,相反,你應該表現出一個裝載其中的內容將出現。仍然在你的情況下,如果你在前臺加載動畫,你將如何能夠滾動? – 2014-11-06 09:40:20