私は背景イメージが必要な単純なレイアウトを持っています。最初にxmlを通して背景画像を入れようとしましたが、非常に遅れがありました。背景とフレームのスキップを引き起こす背景イメージ
だから私はSet image through AsyncTaskに続きましたが、運がまだありません。
画像は1131×1800の解像度で、サイズは369kbです。
I/Choreographer: Skipped 33 frames! The application may be doing too much work on its main thread.
I/Choreographer: Skipped 37 frames! The application may be doing too much work on its main thread.
I/Choreographer: Skipped 34 frames! The application may be doing too much work on its main thread.
I/Choreographer: Skipped 34 frames! The application may be doing too much work on its main thread.
I/Choreographer: Skipped 34 frames! The application may be doing too much work on its main thread.
Javaファイル
public class MainActivity extends flights{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
new LoadDrawable().execute();
}
private class LoadDrawable extends AsyncTask<Drawable, Void, Drawable> {
@Override
protected Drawable doInBackground(Drawable... params) {
//Loading the drawable in the background
final Drawable image = getResources().getDrawable(R.drawable.as);
//After the drawable is loaded, onPostExecute is called
return image;
}
@Override
protected void onPostExecute(Drawable loaded) {
//Hide the progress bar
//ProgressBar progress = (ProgressBar) findViewById(R.id.progress_bar);
//progress.setVisibility(View.GONE);
//Set the layout background with your loaded drawable
RelativeLayout layout = (RelativeLayout) findViewById(R.id.root);
layout.setBackgroundDrawable(loaded);
}
@Override
protected void onPreExecute() {}
@Override
protected void onProgressUpdate(Void... values) {}
}
}
私はサイズ12.14キロバイトの1125 X 1442解像度の画像で私の方法を試してみました。そして、同じ遅れとスキッピングのフレームがあります。 P.S 私はクリック時に非常に小さい画像を回転させる。アニメート機能を使用しています。私は背景として色を選択すると、ラグの問題はありませんが、私はバックグラウンドとしてイメージを持っているので、ラグがあります。 – Swarnveer
BitmapDrawableでも参照しましたが、同じ問題があります。 – Swarnveer
アニメーションなしで試しましたか? –