Android - Set a view to be on top of items drawn with canvas

DaveHolman

New Member
I have an android app where the user paints, moves and reshapes some objects over a photo. In this page my screen layout consists of the photo that is loaded and below it (in portrait view) some buttons. My view looks exactly as I want it with the xml below:\[code\]<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:id="@+id/linear" > <LinearLayout android:id="@+id/buttons" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center" android:layout_alignParentBottom="true"> <ImageView android:id="@+id/draw" android:layout_width="80dp" android:layout_height="50dp" android:clickable="true" android:src="http://stackoverflow.com/questions/10784655/@drawable/draw"/> <ImageView android:id="@+id/delete" android:layout_width="80dp" android:layout_height="50dp" android:clickable="true" android:layout_toRightOf="@+id/erase" android:src="http://stackoverflow.com/questions/10784655/@drawable/delete"/> <ImageView android:id="@+id/done" android:layout_width="80dp" android:clickable="true" android:layout_height="50dp" android:layout_toRightOf="@+id/delete" android:src="http://stackoverflow.com/questions/10784655/@drawable/done"/> </LinearLayout> <ImageView android:id="@+id/photo" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center" android:layout_above="@id/buttons"/></RelativeLayout>\[/code\]The problem is that I want the buttons to be always on top of the painted objects. Now if the user paints a line and then moves it in a way that one edge will go lower than the image, then this line will be over the buttons. It will be untouchable at that point because the canvas is set to the bitmap that has my image, but it will be visible. I would like it to disappear in the way it disappears if part of the line gets out of screen. How can I implement this? Is there some attribute that can ensure that these buttons are always over the painted objects? Thank you in advance!
 
Back
Top