geo*_*rge 6 xml android always-on-top android-layout android-canvas
我有一个Android应用程序,用户在照片上绘制,移动和重塑一些对象.在此页面中,我的屏幕布局包括加载的照片和在其下方(纵向视图)的一些按钮.我的视图看起来与我想要的xml如下:
<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="@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="@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="@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>
Run Code Online (Sandbox Code Playgroud)
问题是我希望按钮始终位于绘制对象的顶部.现在,如果用户绘制一条线然后以一条边缘将低于图像的方式移动它,则该线将在按钮上方.在那一点上它是不可触摸的,因为画布被设置为具有我的图像的位图,但它将是可见的.如果线的一部分离开屏幕,我希望它以消失的方式消失.
我该如何实现呢?是否有一些属性可以确保这些按钮始终位于绘制的对象上?先感谢您!
如果你@Override onDraw或onLayout方法,尝试带来
<LinearLayout
android:id="@+id/buttons">
Run Code Online (Sandbox Code Playgroud)
在前面使用v.bringToFront()哪里v将是你的LinearLayout.
| 归档时间: |
|
| 查看次数: |
11885 次 |
| 最近记录: |