package net.dixq.painter; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.util.AttributeSet; import android.view.View; public class PaintView extends View { public PaintView(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void onMeasure(int w, int h ){ super.onMeasure(w,h); } @Override protected void onDraw(Canvas c){ c.drawColor(Color.WHITE); } }
<?xml version="1.0" encoding="utf-8"?> <resources> <color name="col_red">#e55</color> <color name="col_green">#5e5</color> <color name="col_blue">#55e</color> </resources>
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <LinearLayout android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="wrap_content" > <ImageButton android:id="@+id/btnRed" android:layout_width="wrap_content" android:layout_height="50dp" android:layout_weight="1" android:background="@color/col_red" android:src="@android:drawable/ic_menu_edit" /> <ImageButton android:id="@+id/btnGreen" android:layout_width="wrap_content" android:layout_height="50dp" android:layout_weight="1" android:background="@color/col_green" android:src="@android:drawable/ic_menu_edit" /> <ImageButton android:id="@+id/btnBlue" android:layout_width="wrap_content" android:layout_height="50dp" android:layout_weight="1" android:background="@color/col_blue" android:src="@android:drawable/ic_menu_edit" /> <ImageButton android:id="@+id/btnEraser" android:layout_width="wrap_content" android:layout_height="50dp" android:layout_weight="1" android:src="@android:drawable/alert_light_frame" /> </LinearLayout> <net.dixq.painter.PaintView android:id="@+id/paintView" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </LinearLayout>
Portions of this page are modifications
based on work created and shared by Google and used according to terms
described in the Creative Commons 3.0 Attribution License.
- Remical Soft -