Hi All, I am trying to draw a custom view extending linearlayout and put a scrollview within that.
I should be able to draw objects on top of scrollview. But the views which i draw are drawing down the scrollview.It is not drawing on top layer of scrollview. I tried with framelayout.But it is not drawing down of scrollview only. How to make it to draw on top? I tried using FrameLayout.But still same problem. Please help.It is very urgent. I have attached code for your reference. main.xml ----------------- <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/mylayout" > <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <com.horizonscroll.TransparentPanel android:id="@+id/transparent_panel" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#FFFFFF" > <com.horizonscroll.ScrollImageView android:id = "@+id/scrollView" android:layout_width="fill_parent" android:layout_height="wrap_content" /> </com.horizonscroll.TransparentPanel> </FrameLayout> </FrameLayout> TransparentPanel.java ------------------------------ public class TransparentPanel extends LinearLayout { private static Vector<Square> squares; private static Vector<Tile> tiles; private static Tile movingTile=null; private Paint touchPaint; public TransparentPanel(Context context, AttributeSet attrs) { super(context, attrs); init(context); } public TransparentPanel(Context context) { super(context); init(context); } private void init(Context context) { squares=Util.generateBoardSquares(); tiles=Util.generateTiles(context); } @Override public boolean onTouchEvent(MotionEvent event) { System.out.println(event.getY()); int x=(int) event.getX(); int y=(int) event.getY(); if(event.getAction() == MotionEvent.ACTION_DOWN){ for(int i=0;i<tiles.size();i++){ if(tiles.get(i).isTouched(x, y)){ movingTile=tiles.get(i); break; } } } if(event.getAction() == MotionEvent.ACTION_MOVE){ if(movingTile != null){ movingTile.setX(x); movingTile.setY(y); invalidate(); } } if(event.getAction() == MotionEvent.ACTION_UP){ if(movingTile != null){ movingTile=null; } } invalidate(); return true; } @Override protected void onDraw(Canvas canvas) { for(int i=0;i<tiles.size();i++){ Tile tile=tiles.get(i); tile.onDraw(canvas, touchPaint,tile.getX(),tile.getY()); } super.dispatchDraw(canvas); } } Activity ---------------------- public class HorizoontalScroll extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.main); } } -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

