package info.delorenzo.quindici
Code: Select all
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/textTite"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="false"
android:text="@string/app_name" />
<!-- THIS IS IMPORTANT -->
<info.delorenzo.quindici.Panel
android:layout_width="fill_parent"
android:layout_height="330dp" />
<!-- --------------------------- -->
<TextView
android:id="@+id/textTime"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="false"
android:text="TIME" />
</LinearLayout>
<info.delorenzo.quindici.Panel ... /> is the SurfaceView View in the layout between two TextView elements
The Panel class:
package info.delorenzo.quindici;
Code: Select all
import ...;
public class Panel extends SurfaceView implements SurfaceHolder.Callback {
public Panel(Context context) {
super(context);
}
public Panel(Context context, AttributeSet attrs) {
super(context, attrs);
}
public Panel(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
drawGrid();
}
private void drawGrid()
{
canvas = this.holder.lockCanvas();
canvas.drawRect(x1,y1,x2,y2, paint );
this.holder.unlockCanvasAndPost(canvas);
}
}