大家好我想让我的DrawingSurface视图透明.我试了很多东西,但它不起作用.
这是我的表面视图透明的xml代码
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/icon" >
</ImageView>
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#00000000" >
<codewalla.android.drawings.DrawingSurface
android:id="@+id/drawingSurface"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</codewalla.android.drawings.DrawingSurface>
</LinearLayout>
</FrameLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="@+id/colorRedBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="10"
android:onClick="onClick"
android:text="R" />
<Button
android:id="@+id/colorBlueBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="10"
android:onClick="onClick"
android:text="G" />
<Button
android:id="@+id/colorGreenBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="10"
android:onClick="onClick"
android:text="B" />
<Button
android:id="@+id/undoBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="10"
android:onClick="onClick"
android:text="U" />
<Button
android:id="@+id/redoBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="10"
android:onClick="onClick"
android:text="R" />
</LinearLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud) 我打算用可缩放的用户界面编写一个2D绘图应用程序.使用该应用程序,用户应该能够转换(平移和缩放)绘制的路径(当然还有UI).我假设同时会有多达500个路径.现在,我想知道从哪个视图开始(View,SurfaceView或GLSurfaceView)以提供可接受的性能.我阅读了几篇帖子[1-6],包括曾经在Android上的开发者指南,我仍然不能100%确定使用哪个视图.
根据Google I/O 2009(http://youtu.be/U4Bk5rmIpic?t=45m10s)上的演示文稿和自己的体验,在处理100多个路径时,canvas(View和SurfaceView)似乎没有足够快的性能.
有没有人看到使用画布实现应用程序的可能性或OpenGL的方式去?
[1] Android:在SurfaceView和OpenGL之间做出决定(GLSurfaceView)
[2] SurfaceView或GLSurfaceview?
[4] http://pierrchen.blogspot.jp/2014/03/anroid-graphics-surfaceview-all-you.html
我想知道SurfaceView和ImageView之间的区别及其使用场景.两者似乎都是一样的.如果有可能错过的链接,请指导我.
小序幕: 我正在为Android创建一种绘图应用程序(API 14及更高版本).几个月前我开始研究它并决定使用SurfaceView作为画布来绘制.我认为这是一个很好的决定,因为 SurfaceView 可以直接使用Graphics.一切似乎工作正常,直到有一天我注意到绘图过程有点滞后.那里可能有很多奇怪的代码.
无论如何,现在我正在优化代码和东西,我想,我真的需要使用SurfaceView这样的场景吗?我需要从"画布"中获取的主要内容是绘制平滑并能够将所有绘图保存到位图 - >外部存储上的文件(这样可以正常工作).
那么,我应该使用简单的View还是SurfaceView?此外,听到你的决定/主张的道具和缺点会很棒.
谢谢