2 Image views in Android?
I have a relative layout with 2 image views in them, I try and set the xpos of image view 2 and it seems to appear inside image view 1, as if image view 1 is masking it, whats happening?
xylophoneHolder = new HorizontalScrollView(context);
xylophoneLayout = new RelativeLayout(context);
xylophoneHolder.addView(xylophoneLayout);
ImageView xylophoneA = new ImageView(context);
Bitmap bMap = BitmapFactory.decodeResource(context.getResources(),R.drawable.xylophone_a);
xylophoneA.setImageBitmap(bMap);
xylophoneL开发者_Go百科ayout.addView(xylophoneA);
ImageView xylophoneAPressed = new ImageView(context);
Bitmap bMap2 = BitmapFactory.decodeResource(context.getResources(),R.drawable.xylophone_a_pressed);
xylophoneAPressed.setImageBitmap(bMap2);
xylophoneAPressed.setX(100);
xylophoneLayout.addView(xylophoneAPressed);
I think it is better to use LinearLayout with orientation instead of RelativeLayout, with LinearLayout it is worked for me
精彩评论