【问题标题】:Skipped Frames On Choreographer On Changing Background Colors更改背景颜色时编舞者跳帧
【发布时间】:2013-05-17 08:54:07
【问题描述】:

嗨,我正在尝试构建一个应用程序,它可以将屏幕变成闪光灯或警笛之类的东西。在带有 2.3 android 的 Galaxy gio 上进行了测试。在 2.3 + 设备上它卡在第一种颜色上。 logcat 上的错误是跳过帧对活动来说工作量太大! 我试图减少延迟,但它不起作用。它只适用于 4.0 + android 版本我该怎么办?

public class MainActivity extends Activity {

RelativeLayout soli;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //full screeen
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
        WindowManager.LayoutParams.FLAG_FULLSCREEN);
    //full screen
    setContentView(R.layout.activity_main);
    //brightness full
    WindowManager.LayoutParams lp = getWindow().getAttributes();
    lp.screenBrightness = 100 / 100.0f;
    //brightness full
    soli = (RelativeLayout) findViewById(R.id.soli);

}
public void soheil(){


    final RelativeLayout soli = ((RelativeLayout) findViewById(R.id.soli));
    ColorDrawable f = new ColorDrawable(0xff00ff00);
    ColorDrawable f2 = new ColorDrawable(0xffff0000);
    ColorDrawable f3 = new ColorDrawable(0xff0000ff);
    ColorDrawable f4 = new ColorDrawable(0xff0000ff);

    AnimationDrawable a = new AnimationDrawable();
    int DELAY=1500;
    a.addFrame(f, DELAY);
    a.addFrame(f2, DELAY);
    a.addFrame(f3, DELAY);
    a.addFrame(f4, DELAY);
    a.setOneShot(false);

    soli.setBackgroundDrawable(a); //  is deprecated  API 16
    // soli.setBackground(a); //  API 16
    a.start();




}
@Override
protected void onStart() {
super.onStart();soheil();

}
@Override
protected void onDestroy() {
super.onDestroy();

}
@Override
protected void onResume() {
super.onResume();

}
@Override
protected void onPause() {
super.onDestroy();

}
@Override
protected void onStop() {
super.onDestroy();

}

【问题讨论】:

    标签: android android-layout android-logcat android-4.0-ice-cream-sandwich android-2.3-gingerbread


    【解决方案1】:

    发现没关系!这是可能对其他人有用的答案。 我把我所有的图形都放在了一个 touchlistener 事件上,一切都很好。

    【讨论】:

      猜你喜欢
      • 2011-03-26
      • 1970-01-01
      • 2012-07-08
      • 2013-06-19
      • 2011-04-29
      • 1970-01-01
      • 1970-01-01
      • 2013-08-08
      相关资源
      最近更新 更多