now I use canvas(ondraw()
) to draw images of my app and if I want to show some
list in center of my app. What should I suppose to do? I have 2 ideas.
Add ListView in Dialog, but the screen is dark, which I don't want it to be.
Add ListView in LinearLayout and make it to
Bitmap
which I can't draw image, mycode is this following:
ListView modeList = new ListView(context); modeList.setAdapter(new ImageAdapter(context, objects)); linearlayout = new LinearLayout(context); linearlayout.setOrientation(LinearLayout.VERTICAL); linearlayout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); linearlayout.addView(modeList); linearlayout.layout(0, 0, 200, 200); linearlayout.measure((int)Define.getScreenWidth(), (int)Define.getScreenHeight()); linearlayout.setDrawingCacheEnabled(true); linearlayout.buildDrawingCache(true);
and when I draw
protected void onDraw(Canvas canvas) {
canvas.drawBitmap(linearlayout.getDrawingCache(), 200, 200, null);
}
However, it draws nothing :(